blib/lib/CPAN/Changes/Group.pm

filter: Statementstmt 90.3% 47 / 52 Branchbran 62.5% 5 / 8 Conditioncond 37.5% 3 / 8 MC/DCmcdc 25.0% 1 / 4 Subroutinesub 91.6% 11 / 12 Podpod 100% 5 / 5 totaltotal 80.9% 72 / 89 CC 10 SCAR 12.7
CC
10
Cov
81%
serialize
12.0
__ANON__
4.0
_maybe_entry
2.1
CRAP 3.5
« blib/lib/CPAN/Changes/Entry.pm ↑ Summary corpus/dists/App-Ack.parsed »
1 package CPAN::Changes::Group;
2 17 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 17 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 17 our $VERSION = '0.500005';
6 17 $VERSION =~ tr/_//d;
7  
8 17 ▶use Sub::Quote qw(qsub);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 17 ▶use CPAN::Changes::Entry;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 17 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 17 has _entry => (
14 is => 'rw',
15 handles => {
16 is_empty => 'has_entries',
17 add_changes => 'add_entry',
18 },
19 lazy => 1,
20 default => qsub q{ CPAN::Changes::Entry->new(text => '') },
21 predicate => 1,
22 );
23  
24 1 ▶sub name {
Subroutine name: called CC=2 SCAR=7.1
Pod documented
25 1 my $self = shift;
26 1 my $entry = $self->_entry;
27 1 ▶ return $entry->can('text') ? $entry->text : '';
Branch: 1 branch
BranchTrueFalseTotal
$entry->can('text') ? : 0 1 1
28 }
29  
30 2 ▶sub _maybe_entry {
Subroutine _maybe_entry: called CC=2 SCAR=7.6
31 2 my $self = shift;
32 2 ▶ if ($self->can('changes') == \&changes) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can('changes') == \&CPAN::Changes::Group::changes) { } 2 0 2
33 2 return $self->_entry;
34 }
35 else {
36 0 return CPAN::Changes::Entry->new(
37 text => $self->name,
38 entries => $self->changes,
39 );
40 }
41 }
42  
43 43 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=4 SCAR=13.9
44 43 my ($orig, $self, @args) = @_;
45 43 my $args = $self->$orig(@args);
46 43 ▶ if (!$args->{_entry}) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($args->{"_entry"}) 5 38 43
47 $args->{_entry} = CPAN::Changes::Entry->new({
48 text => $args->{name} || '',
49 5 ▶ entries => $args->{changes} || [],
Condition75%3/4
$args->{'name'} || ''
l!l
32
$args->{'changes'} || []
l!l
05
MC/DC100%1/1
$args->{'name'} || ''
$args->{'name'}
MC/DC0%0/1
$args->{'changes'} || []
$args->{'changes'}
Truth table100%2/2
A
A= $args->{'name'}
Aresult
11
00
Truth table50%1/2
A
A= $args->{'changes'}
Aresult
11
00
50 });
51 }
52 43 $args;
53 17 };
54  
55 35 ▶sub changes {
Subroutine changes: called CC=2 SCAR=7.0
Pod documented
56 35 my ($self) = @_;
57 35 ▶ return []
Branch: 1 branch
BranchTrueFalseTotal
unless $self->_has_entry 0 35 35
58 unless $self->_has_entry;
59 35 [ map { $_->text } @{ $self->_entry->entries } ];
60 }
61  
62 1 ▶sub set_changes {
Subroutine set_changes: called CC=2 SCAR=6.9
Pod documented
63 1 my ($self, @changes) = @_;
64 1 $self->clear_changes;
65 1 my $entry = $self->_entry;
66 1 for my $change (@changes) {
67 2 $entry->add_entry($change);
68 }
69 1 return;
70 }
71  
72 1 ▶sub clear_changes {
Subroutine clear_changes: called CC=1 SCAR=0.0
Pod documented
73 1 my ($self) = @_;
74 1 my $entry = $self->_entry;
75 1 @{$entry->entries} = ();
76 1 $self->changes;
77 }
78  
79 0 ▶sub serialize {
Subroutine serialize: not called CC=3 SCAR=24.8
Pod documented
80 0 my ($self, %args) = @_;
81 0 ▶ $args{indents} ||= [' ', ' '];
Condition0%0/2
$args{"indents"} ||= [" ", " "]
l!l
00
MC/DC0%0/1
$args{"indents"} ||= [" ", " "]
$args{"indents"}
Truth table0%0/2
A
A= $args{"indents"}
Aresult
11
00
82 0 ▶ $args{styles} ||= ['[]', '-'];
Condition0%0/2
$args{"styles"} ||= ["[]", "-"]
l!l
00
MC/DC0%0/1
$args{"styles"} ||= ["[]", "-"]
$args{"styles"}
Truth table0%0/2
A
A= $args{"styles"}
Aresult
11
00
83 0 $self->_maybe_entry->serialize(%args);
84 }
85  
86 17 1;
87 __END__
« blib/lib/CPAN/Changes/Entry.pm ↑ Summary corpus/dists/App-Ack.parsed »