| 1 | package JIRA::REST::Class::Issue::Type; | ||||||||||
| 2 | 4 | ▶ | use parent qw( JIRA::REST::Class::Abstract ); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 4 | ▶ | use 5.010; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 4 | our $VERSION = '0.10'; | |||||||||
| 8 | 4 | our $SOURCE = 'CPAN'; | |||||||||
| 9 | ## $SOURCE = 'GitHub'; # COMMENT | ||||||||||
| 10 | # the line above will be commented out by Dist::Zilla | ||||||||||
| 11 | |||||||||||
| 12 | # ABSTRACT: A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents a JIRA issue type as an object. | ||||||||||
| 13 | |||||||||||
| 14 | 4 | ▶ | use Readonly 2.04; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | |||||||||||
| 16 | 4 | Readonly my @ACCESSORS => qw( description iconUrl id name self subtask ); | |||||||||
| 17 | |||||||||||
| 18 | 4 | __PACKAGE__->mk_data_ro_accessors( @ACCESSORS ); | |||||||||
| 19 | |||||||||||
| 20 | #pod =head1 DESCRIPTION | ||||||||||
| 21 | #pod | ||||||||||
| 22 | #pod This object represents a type of JIRA issue as an object. It is overloaded | ||||||||||
| 23 | #pod so it returns the C<key> of the issue type when stringified, the C<id> of | ||||||||||
| 24 | #pod the issue type when it is used in a numeric context, and the value of the | ||||||||||
| 25 | #pod C<subtask> field if is used in a boolean context. If two of these objects | ||||||||||
| 26 | #pod are compared I<as strings>, the C<key> of the issue types will be used for | ||||||||||
| 27 | #pod the comparison, while numeric comparison will compare the C<id>s of the | ||||||||||
| 28 | #pod issue types. | ||||||||||
| 29 | #pod | ||||||||||
| 30 | #pod =cut | ||||||||||
| 31 | |||||||||||
| 32 | #<<< | ||||||||||
| 33 | use overload | ||||||||||
| 34 | 14 | ▶ | '""' => sub { shift->name }, | ||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||
| 35 | 0 | ▶ | '0+' => sub { shift->id }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 36 | 0 | ▶ | 'bool' => sub { shift->subtask }, | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 37 | '<=>' => sub { | ||||||||||
| 38 | 0 | ▶ | my( $A, $B ) = @_; | ||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||
| 39 | 0 | ▶ | my $AA = ref $A ? $A->id : $A; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 40 | 0 | ▶ | my $BB = ref $B ? $B->id : $B; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 41 | 0 | $AA <=> $BB | |||||||||
| 42 | }, | ||||||||||
| 43 | 'cmp' => sub { | ||||||||||
| 44 | 39 | ▶ | my( $A, $B ) = @_; | ||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=11.4
| |||||||||||
| 45 | 39 | ▶ | my $AA = ref $A ? $A->name : $A; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 46 | 39 | ▶ | my $BB = ref $B ? $B->name : $B; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 47 | 39 | $AA cmp $BB | |||||||||
| 48 | 4 | ▶ | }; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 49 | #>>> | ||||||||||
| 50 | |||||||||||
| 51 | 4 | 1; | |||||||||
| 52 | |||||||||||
| 53 | #pod =accessor B<description> | ||||||||||
| 54 | #pod | ||||||||||
| 55 | #pod Returns the description of the issue type. | ||||||||||
| 56 | #pod | ||||||||||
| 57 | #pod =accessor B<iconUrl> | ||||||||||
| 58 | #pod | ||||||||||
| 59 | #pod Returns the URL of the icon the issue type. | ||||||||||
| 60 | #pod | ||||||||||
| 61 | #pod =accessor B<id> | ||||||||||
| 62 | #pod | ||||||||||
| 63 | #pod Returns the id of the issue type. | ||||||||||
| 64 | #pod | ||||||||||
| 65 | #pod =accessor B<name> | ||||||||||
| 66 | #pod | ||||||||||
| 67 | #pod Returns the name of the issue type. | ||||||||||
| 68 | #pod | ||||||||||
| 69 | #pod =accessor B<self> | ||||||||||
| 70 | #pod | ||||||||||
| 71 | #pod Returns the JIRA REST API URL of the issue type. | ||||||||||
| 72 | #pod | ||||||||||
| 73 | #pod =accessor B<subtask> | ||||||||||
| 74 | #pod | ||||||||||
| 75 | #pod Returns a boolean indicating whether the issue type is a subtask. | ||||||||||
| 76 | #pod | ||||||||||
| 77 | #pod =for stopwords iconUrl | ||||||||||
| 78 | #pod | ||||||||||
| 79 | #pod =cut | ||||||||||
| 80 | |||||||||||
| 81 | __END__ | ||||||||||
| 82 | |||||||||||
| 83 | =pod | ||||||||||
| 84 | |||||||||||
| 85 | =encoding UTF-8 | ||||||||||
| 86 | |||||||||||
| 87 | =for :stopwords Packy Anderson Alexey Melezhik iconUrl | ||||||||||
| 88 | |||||||||||
| 89 | =head1 NAME | ||||||||||
| 90 | |||||||||||
| 91 | JIRA::REST::Class::Issue::Type - A helper class for L<JIRA::REST::Class|JIRA::REST::Class> that represents a JIRA issue type as an object. | ||||||||||
| 92 | |||||||||||
| 93 | =head1 VERSION | ||||||||||
| 94 | |||||||||||
| 95 | version 0.10 | ||||||||||
| 96 | |||||||||||
| 97 | =head1 DESCRIPTION | ||||||||||
| 98 | |||||||||||
| 99 | This object represents a type of JIRA issue as an object. It is overloaded | ||||||||||
| 100 | so it returns the C<key> of the issue type when stringified, the C<id> of | ||||||||||
| 101 | the issue type when it is used in a numeric context, and the value of the | ||||||||||
| 102 | C<subtask> field if is used in a boolean context. If two of these objects | ||||||||||
| 103 | are compared I<as strings>, the C<key> of the issue types will be used for | ||||||||||
| 104 | the comparison, while numeric comparison will compare the C<id>s of the | ||||||||||
| 105 | issue types. | ||||||||||
| 106 | |||||||||||
| 107 | =head1 READ-ONLY ACCESSORS | ||||||||||
| 108 | |||||||||||
| 109 | =head2 B<description> | ||||||||||
| 110 | |||||||||||
| 111 | Returns the description of the issue type. | ||||||||||
| 112 | |||||||||||
| 113 | =head2 B<iconUrl> | ||||||||||
| 114 | |||||||||||
| 115 | Returns the URL of the icon the issue type. | ||||||||||
| 116 | |||||||||||
| 117 | =head2 B<id> | ||||||||||
| 118 | |||||||||||
| 119 | Returns the id of the issue type. | ||||||||||
| 120 | |||||||||||
| 121 | =head2 B<name> | ||||||||||
| 122 | |||||||||||
| 123 | Returns the name of the issue type. | ||||||||||
| 124 | |||||||||||
| 125 | =head2 B<self> | ||||||||||
| 126 | |||||||||||
| 127 | Returns the JIRA REST API URL of the issue type. | ||||||||||
| 128 | |||||||||||
| 129 | =head2 B<subtask> | ||||||||||
| 130 | |||||||||||
| 131 | Returns a boolean indicating whether the issue type is a subtask. | ||||||||||
| 132 | |||||||||||
| 133 | =head1 RELATED CLASSES | ||||||||||
| 134 | |||||||||||
| 135 | =over 2 | ||||||||||
| 136 | |||||||||||
| 137 | =item * L<JIRA::REST::Class|JIRA::REST::Class> | ||||||||||
| 138 | |||||||||||
| 139 | =item * L<JIRA::REST::Class::Abstract|JIRA::REST::Class::Abstract> | ||||||||||
| 140 | |||||||||||
| 141 | =back | ||||||||||
| 142 | |||||||||||
| 143 | =head1 AUTHOR | ||||||||||
| 144 | |||||||||||
| 145 | Packy Anderson <packy@cpan.org> | ||||||||||
| 146 | |||||||||||
| 147 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 148 | |||||||||||
| 149 | This software is Copyright (c) 2017 by Packy Anderson. | ||||||||||
| 150 | |||||||||||
| 151 | This is free software, licensed under: | ||||||||||
| 152 | |||||||||||
| 153 | The Artistic License 2.0 (GPL Compatible) | ||||||||||
| 154 | |||||||||||
| 155 | =cut | ||||||||||