blib/lib/Bootylicious/ArticleArchiveYearly.pm

filter: Statementstmt 96.8% 31 / 32 Branchbran 100% 4 / 4 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 87.5% 7 / 8 Podpod 0.0% 0 / 3 totaltotal 90.9% 50 / 55 CC 6 SCAR 12.2
CC
6
Cov
98%
build
6.0
is_monthly
2.0
BEGIN
1.0
CRAP 3.4
« blib/lib/Bootylicious/Timestamp.pm ↑ Summary blib/lib/Bootylicious/Plugin/Admin.pm »
1 package Bootylicious::ArticleArchiveYearly;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base 'Bootylicious::ArticleArchiveBase';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 ▶use Bootylicious::Iterator;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use Bootylicious::Year;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 sub build {
12 3 ▶ my $self = shift;
Subroutine build: called CC=6 SCAR=17.9
Pod undocumented
13  
14 3 my $years = {};
15 3 ▶ while (my $article = $self->articles->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $article = $self->articles->next) 6 3 9
16 6 my $year = $article->created->year;
17  
18 6 ▶ next if $self->year && $self->year != $year;
Branch: 1 branch
BranchTrueFalseTotal
if $self->year and $self->year != $year 1 5 6
Condition100%3/3
$self->year and $self->year != $year
!ll&&!rl&&r
321
MC/DC100%2/2
$self->year and $self->year != $year
$self->year $self->year != $year
Truth table100%3/3
A and B
A= $self->yearB= $self->year != $year
ABresult
0X0
100
111
19  
20 5 ▶ $years->{$year} ||= [];
Condition100%2/2
$years->{$year} ||= []
l!l
23
MC/DC100%1/1
$years->{$year} ||= []
$years->{$year}
Truth table100%2/2
A
A= $years->{$year}
Aresult
11
00
21 5 push @{$years->{$year}}, $article;
22 }
23  
24 3 my @years;
25 3 foreach my $year (sort { $b <=> $a } keys %$years) {
26 push @years,
27 Bootylicious::Year->new(
28 year => $year,
29 articles => Bootylicious::Iterator->new(
30 3 elements => $years->{$year}
31 )
32 );
33 }
34  
35 $self->articles(
36 3 Bootylicious::Iterator->new(elements => [@years]));
37  
38 3 return $self;
39 }
40  
41 2 ▶sub is_yearly {1}
Subroutine is_yearly: called CC=1 SCAR=0.0
Pod undocumented
42 0 ▶sub is_monthly {0}
Subroutine is_monthly: not called CC=1 SCAR=6.9
Pod undocumented
43  
44 2 1;
« blib/lib/Bootylicious/Timestamp.pm ↑ Summary blib/lib/Bootylicious/Plugin/Admin.pm »