Cogit/Object/Tag.pm

filter: Statementstmt 52.6% 20 / 38 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 1 totaltotal 39.6% 23 / 58 CC 6 SCAR 27.1
CC
6
Cov
41%
BUILD
30.0
__ANON__
6.0
__ANON__
1.1
CRAP 15.1
« Cogit/Protocol.pm ↑ Summary Cogit/PackIndex/Version2.pm »
1 package Cogit::Object::Tag;
2 4 $Cogit::Object::Tag::VERSION = '0.001001';
3 4 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 4 ▶use MooX::Types::MooseLike::Base 'Str', 'InstanceOf';
Subroutine BEGIN: called CC=1 SCAR=0.0
5 4 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 4 extends 'Cogit::Object';
8  
9 0 ▶has '+kind' => ( default => sub { 'tag' } );
Subroutine __ANON__: not called CC=1 SCAR=1.2
10  
11 4 has object => (
12 is => 'rw',
13 isa => Str,
14 );
15  
16 4 has tag => (
17 is => 'rw',
18 isa => Str,
19 );
20  
21 4 has tagger => (
22 is => 'rw',
23 isa => InstanceOf['Cogit::Actor'],
24 );
25  
26 4 has tagged_time => (
27 is => 'rw',
28 isa => InstanceOf['DateTime'],
29 );
30  
31 4 has comment => (
32 is => 'rw',
33 isa => Str,
34 );
35  
36 has object_kind => (
37 is => 'rw',
38 0 ▶ isa => sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
39 0 ▶ die "$_[0] is not a valid object type" unless $_[0] =~ m/commit|tree|blob|tag/
Branch: 1 branch
BranchTrueFalseTotal
unless $_[0] =~ /commit|tree|blob|tag/ 0 0 0
40 },
41 4 );
42  
43 4 my %method_map = (type => 'object_kind');
44  
45 0 ▶sub BUILD {
Subroutine BUILD: not called CC=5 SCAR=34.0
Pod undocumented
46 0 my $self = shift;
47 0 my @lines = split "\n", $self->content;
48 0 ▶ while ( my $line = shift @lines ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $line = shift @lines) 0 0 0
49 0 ▶ last unless $line;
Branch: 1 branch
BranchTrueFalseTotal
unless $line 0 0 0
50 0 my ( $key, $value ) = split ' ', $line, 2;
51  
52 0 ▶ if ($key eq 'tagger') {
Branch: 1 branch
BranchTrueFalseTotal
if ($key eq 'tagger') { } 0 0 0
53 0 my @data = split ' ', $value;
54 0 my ($email, $epoch, $tz) = splice(@data, -3);
55 0 my $name = join(' ', @data);
56 0 my $actor =
57 Cogit::Actor->new( name => $name, email => $email );
58 0 $self->tagger($actor);
59 0 my $dt= DateTime->from_epoch( epoch => $epoch, time_zone => $tz );
60 0 $self->tagged_time($dt);
61 } else {
62 0 ▶ my $method = $method_map{$key} || $key;
Condition0%0/3
$method_map{$key} || $key
l!l&&r!l&&!r
000
MC/DC0%0/2
$method_map{$key} || $key
$method_map{$key} $key
Truth table0%0/3
A || B
A= $method_map{$key}B= $key
ABresult
1X1
011
000
63 0 $self->$method($value);
64 }
65 }
66 0 $self->comment( join "\n", @lines );
67 }
68  
69 4 1;
70  
71 __END__
« Cogit/Protocol.pm ↑ Summary Cogit/PackIndex/Version2.pm »