| 1 | package WWW::Gitea::Issue; | ||||||||||||
| 2 | |||||||||||||
| 3 | # ABSTRACT: Gitea issue entity | ||||||||||||
| 4 | |||||||||||||
| 5 | 5 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | 5 | ▶ | use namespace::clean; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | |||||||||||||
| 8 | |||||||||||||
| 9 | 5 | has _client => ( | |||||||||||
| 10 | is => 'ro', | ||||||||||||
| 11 | required => 1, | ||||||||||||
| 12 | weak_ref => 1, | ||||||||||||
| 13 | init_arg => 'client', | ||||||||||||
| 14 | ); | ||||||||||||
| 15 | |||||||||||||
| 16 | 5 | has data => ( | |||||||||||
| 17 | is => 'rw', | ||||||||||||
| 18 | required => 1, | ||||||||||||
| 19 | ); | ||||||||||||
| 20 | |||||||||||||
| 21 | |||||||||||||
| 22 | 5 | has owner => ( is => 'ro' ); | |||||||||||
| 23 | 5 | has repo => ( is => 'ro' ); | |||||||||||
| 24 | |||||||||||||
| 25 | |||||||||||||
| 26 | 2 | ▶ | sub _owner { | ||||||||||
|
Subroutine
_owner: called CC=3 SCAR=11.0
| |||||||||||||
| 27 | 2 | my ($self) = @_; | |||||||||||
| 28 | 2 | ▶ | return $self->owner if defined $self->owner; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 29 | 1 | my $r = $self->data->{repository}; | |||||||||||
| 30 | 1 | ▶ | return $r ? $r->{owner} : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 31 | } | ||||||||||||
| 32 | |||||||||||||
| 33 | 2 | ▶ | sub _repo { | ||||||||||
|
Subroutine
_repo: called CC=3 SCAR=11.0
| |||||||||||||
| 34 | 2 | my ($self) = @_; | |||||||||||
| 35 | 2 | ▶ | return $self->repo if defined $self->repo; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 36 | 1 | my $r = $self->data->{repository}; | |||||||||||
| 37 | 1 | ▶ | return $r ? $r->{name} : undef; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | } | ||||||||||||
| 39 | |||||||||||||
| 40 | 0 | ▶ | sub id { $_[0]->data->{id} } | ||||||||||
|
Subroutine
id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 41 | 1 | ▶ | sub number { $_[0]->data->{number} } | ||||||||||
|
Subroutine
number: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 42 | 0 | ▶ | sub title { $_[0]->data->{title} } | ||||||||||
|
Subroutine
title: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 43 | 0 | ▶ | sub body { $_[0]->data->{body} } | ||||||||||
|
Subroutine
body: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 44 | 1 | ▶ | sub state { $_[0]->data->{state} } | ||||||||||
|
Subroutine
state: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 45 | 0 | ▶ | sub html_url { $_[0]->data->{html_url} } | ||||||||||
|
Subroutine
html_url: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 46 | 0 | ▶ | sub created_at { $_[0]->data->{created_at} } | ||||||||||
|
Subroutine
created_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 47 | 0 | ▶ | sub updated_at { $_[0]->data->{updated_at} } | ||||||||||
|
Subroutine
updated_at: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 48 | 1 | ▶ | sub comments_count { $_[0]->data->{comments} } | ||||||||||
|
Subroutine
comments_count: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||
| 49 | 1 | ▶ | sub user_login { my $u = $_[0]->data->{user}; $u ? $u->{login} : undef } | ||||||||||
|
Subroutine
user_login: called CC=2 SCAR=7.2
Pod
documented
Branch: 1 branch
| |||||||||||||
| 50 | |||||||||||||
| 51 | 1 | ▶ | sub label_names { | ||||||||||
|
Subroutine
label_names: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||
| 52 | 1 | my ($self) = @_; | |||||||||||
| 53 | 1 | ▶ | return [ map { $_->{name} } @{ $self->data->{labels} || [] } ]; | ||||||||||
|
Condition50%1/2
$self->data->{'labels'} || []
MC/DC0%0/1
$self->data->{'labels'} || []
$self->data->{'labels'}
Truth table50%1/2
A
A= $self->data->{'labels'}
| |||||||||||||
| 54 | } | ||||||||||||
| 55 | |||||||||||||
| 56 | 1 | ▶ | sub assignee_logins { | ||||||||||
|
Subroutine
assignee_logins: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||
| 57 | 1 | my ($self) = @_; | |||||||||||
| 58 | 1 | ▶ | return [ map { $_->{login} } @{ $self->data->{assignees} || [] } ]; | ||||||||||
|
Condition50%1/2
$self->data->{'assignees'} || []
MC/DC0%0/1
$self->data->{'assignees'} || []
$self->data->{'assignees'}
Truth table50%1/2
A
A= $self->data->{'assignees'}
| |||||||||||||
| 59 | } | ||||||||||||
| 60 | |||||||||||||
| 61 | |||||||||||||
| 62 | 0 | ▶ | sub refresh { | ||||||||||
|
Subroutine
refresh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 63 | 0 | my ($self) = @_; | |||||||||||
| 64 | 0 | my $fresh = $self->_client->issues->get($self->_owner, $self->_repo, $self->number); | |||||||||||
| 65 | 0 | $self->data($fresh->data); | |||||||||||
| 66 | 0 | return $self; | |||||||||||
| 67 | } | ||||||||||||
| 68 | |||||||||||||
| 69 | |||||||||||||
| 70 | 0 | ▶ | sub edit { | ||||||||||
|
Subroutine
edit: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 71 | 0 | my ($self, %args) = @_; | |||||||||||
| 72 | 0 | my $fresh = $self->_client->issues->edit( | |||||||||||
| 73 | $self->_owner, $self->_repo, $self->number, %args); | ||||||||||||
| 74 | 0 | $self->data($fresh->data); | |||||||||||
| 75 | 0 | return $self; | |||||||||||
| 76 | } | ||||||||||||
| 77 | |||||||||||||
| 78 | |||||||||||||
| 79 | 0 | ▶ | sub close { | ||||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 80 | 0 | my ($self) = @_; | |||||||||||
| 81 | 0 | return $self->edit(state => 'closed'); | |||||||||||
| 82 | } | ||||||||||||
| 83 | |||||||||||||
| 84 | |||||||||||||
| 85 | 0 | ▶ | sub reopen { | ||||||||||
|
Subroutine
reopen: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 86 | 0 | my ($self) = @_; | |||||||||||
| 87 | 0 | return $self->edit(state => 'open'); | |||||||||||
| 88 | } | ||||||||||||
| 89 | |||||||||||||
| 90 | |||||||||||||
| 91 | 0 | ▶ | sub add_comment { | ||||||||||
|
Subroutine
add_comment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 92 | 0 | my ($self, $body) = @_; | |||||||||||
| 93 | 0 | return $self->_client->issues->create_comment( | |||||||||||
| 94 | $self->_owner, $self->_repo, $self->number, $body); | ||||||||||||
| 95 | } | ||||||||||||
| 96 | |||||||||||||
| 97 | |||||||||||||
| 98 | 0 | ▶ | sub attachments { | ||||||||||
|
Subroutine
attachments: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 99 | 0 | my ($self, %query) = @_; | |||||||||||
| 100 | 0 | return $self->_client->issues->attachments( | |||||||||||
| 101 | $self->_owner, $self->_repo, $self->number, %query); | ||||||||||||
| 102 | } | ||||||||||||
| 103 | |||||||||||||
| 104 | |||||||||||||
| 105 | 0 | ▶ | sub create_attachment { | ||||||||||
|
Subroutine
create_attachment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 106 | 0 | my ($self, %args) = @_; | |||||||||||
| 107 | 0 | return $self->_client->issues->create_attachment( | |||||||||||
| 108 | $self->_owner, $self->_repo, $self->number, %args); | ||||||||||||
| 109 | } | ||||||||||||
| 110 | |||||||||||||
| 111 | |||||||||||||
| 112 | 0 | ▶ | sub get_attachment { | ||||||||||
|
Subroutine
get_attachment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 113 | 0 | my ($self, $attachment_id) = @_; | |||||||||||
| 114 | 0 | return $self->_client->issues->get_attachment( | |||||||||||
| 115 | $self->_owner, $self->_repo, $self->number, $attachment_id); | ||||||||||||
| 116 | } | ||||||||||||
| 117 | |||||||||||||
| 118 | |||||||||||||
| 119 | 0 | ▶ | sub edit_attachment { | ||||||||||
|
Subroutine
edit_attachment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 120 | 0 | my ($self, $attachment_id, %args) = @_; | |||||||||||
| 121 | 0 | return $self->_client->issues->edit_attachment( | |||||||||||
| 122 | $self->_owner, $self->_repo, $self->number, $attachment_id, %args); | ||||||||||||
| 123 | } | ||||||||||||
| 124 | |||||||||||||
| 125 | |||||||||||||
| 126 | 0 | ▶ | sub delete_attachment { | ||||||||||
|
Subroutine
delete_attachment: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||
| 127 | 0 | my ($self, $attachment_id) = @_; | |||||||||||
| 128 | 0 | return $self->_client->issues->delete_attachment( | |||||||||||
| 129 | $self->_owner, $self->_repo, $self->number, $attachment_id); | ||||||||||||
| 130 | } | ||||||||||||
| 131 | |||||||||||||
| 132 | |||||||||||||
| 133 | |||||||||||||
| 134 | 5 | 1; | |||||||||||
| 135 | |||||||||||||
| 136 | __END__ | ||||||||||||