blib/lib/Bootylicious/TagCloud.pm

filter: Statementstmt 97.3% 37 / 38 Branchbran 87.5% 7 / 8 Conditioncond 100% 4 / 4 MC/DCmcdc 100% 2 / 2 Subroutinesub 87.5% 7 / 8 Podpod 33.3% 1 / 3 totaltotal 92.0% 58 / 63 CC 9 SCAR 17.2
CC
9
Cov
96%
build
9.0
modified
2.0
BEGIN
1.0
CRAP 5.6
« blib/lib/Bootylicious/DocumentStatLoader.pm ↑ Summary blib/lib/Bootylicious/Document.pm »
1 package Bootylicious::TagCloud;
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 'Mojo::Base';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 2 __PACKAGE__->attr('articles');
9  
10 2 ▶use Bootylicious::Iterator;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 2 ▶use Bootylicious::Tag;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 sub new {
14 1 ▶ my $self = shift->SUPER::new(@_);
Subroutine new: called CC=1 SCAR=0.0
Pod documented
15  
16 1 return $self->build;
17 }
18  
19 0 ▶sub modified { shift->articles->modified }
Subroutine modified: not called CC=1 SCAR=6.9
Pod undocumented
20  
21 sub build {
22 1 ▶ my $self = shift;
Subroutine build: called CC=9 SCAR=22.0
Pod undocumented
23  
24 1 my $tags = {};
25 1 ▶ while (my $article = $self->articles->next) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $article = $self->articles->next) 2 1 3
26 2 foreach my $name (@{$article->tags}) {
27 4 my $tag = $tags->{$name};
28  
29 4 ▶ $tag->{count} ||= 0;
Condition100%2/2
$tag->{"count"} ||= 0
l!l
13
MC/DC100%1/1
$tag->{"count"} ||= 0
$tag->{"count"}
Truth table100%2/2
A
A= $tag->{"count"}
Aresult
11
00
30 4 $tag->{count}++;
31  
32 4 ▶ $tag->{created} = $article->created unless $tag->{created};
Branch: 1 branch
BranchTrueFalseTotal
unless $tag->{"created"} 3 1 4
33 $tag->{created} = $article->created
34 4 ▶ if $article->created < $tag->{created};
Branch: 1 branch
BranchTrueFalseTotal
if $article->created < $tag->{"created"} 1 3 4
35 4 ▶ $tag->{modified} ||= 0;
Condition100%2/2
$tag->{"modified"} ||= 0
l!l
13
MC/DC100%1/1
$tag->{"modified"} ||= 0
$tag->{"modified"}
Truth table100%2/2
A
A= $tag->{"modified"}
Aresult
11
00
36 $tag->{modified} = $article->modified
37 4 ▶ if $article->modified > $tag->{modified};
Branch: 1 branch
BranchTrueFalseTotal
if $article->modified > $tag->{"modified"} 4 0 4
38  
39 4 $tags->{$name} = $tag;
40 }
41 }
42  
43 1 my @tags;
44 1 foreach my $name (sort keys %$tags) {
45 3 my $tag = $tags->{$name};
46  
47 push @tags,
48 Bootylicious::Tag->new(
49 name => $name,
50 count => $tag->{count},
51 created => $tag->{created},
52 modified => $tag->{modified}
53 3 );
54 }
55  
56 1 return Bootylicious::Iterator->new(elements => [@tags]);
57 }
58  
59 2 1;
« blib/lib/Bootylicious/DocumentStatLoader.pm ↑ Summary blib/lib/Bootylicious/Document.pm »