Chart/Data/Text.pm

filter: Statementstmt 49.0% 25 / 51 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 54.5% 6 / 11 Podpod 66.6% 2 / 3 totaltotal 38.3% 33 / 86 CC 9 SCAR 31.4
CC
9
Cov
37%
BUILDARGS
56.0
__ANON__
12.0
parameter_value
2.0
CRAP 23.2
« Chart/Title.pm ↑ Summary Chart/Type/QRcode.pm »
1 # $Id$
2  
3 package Google::Chart::Data::Text;
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 with 'Google::Chart::Data';
7  
8 1 has '+dataset' => (
9 isa => 'ArrayRef[Google::Chart::Data::Text::DataSet]',
10 );
11  
12 1 __PACKAGE__->meta->make_immutable;
13  
14 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶sub BUILDARGS {
Subroutine BUILDARGS: not called CC=7 SCAR=40.3
Pod documented
17 0 my $self = shift;
18  
19 # A dataset must be an array of arrays or array of values
20 0 my @dataset;
21 my @dataargs;
22 0 my %args;
23  
24 0 ▶ if (@_ == 1 && ref $_[0] eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (@_ == 1 and ref $_[0] eq 'ARRAY') { } 0 0 0
Condition0%0/3
@_ == 1 and ref $_[0] eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ == 1 and ref $_[0] eq "ARRAY"
@_ == 1 ref $_[0] eq "ARRAY"
Truth table0%0/3
A and B
A= @_ == 1B= ref $_[0] eq "ARRAY"
ABresult
0X0
100
111
25 0 @dataargs = @{$_[0]};
26 } else {
27 0 %args = @_;
28 0 ▶ @dataargs = @{ delete $args{dataset} || [] };
Condition0%0/2
delete $args{'dataset'} || []
l!l
00
MC/DC0%0/1
delete $args{'dataset'} || []
delete $args{'dataset'}
Truth table0%0/2
A
A= delete $args{'dataset'}
Aresult
11
00
29 }
30  
31 0 ▶ if (! ref $dataargs[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $dataargs[0]) 0 0 0
32 0 @dataargs = ([ @dataargs]);
33 }
34  
35 0 foreach my $dataset ( @dataargs ) {
36 0 ▶ if (! Scalar::Util::blessed $dataset) {
Branch: 1 branch
BranchTrueFalseTotal
unless (builtin::blessed($dataset)) 0 0 0
37 0 $dataset = Google::Chart::Data::Text::DataSet->new(data => $dataset)
38 }
39 0 push @dataset, $dataset;
40 }
41  
42 0 return { %args, dataset => \@dataset }
43 }
44  
45 0 ▶sub parameter_value {
Subroutine parameter_value: not called CC=1 SCAR=6.9
Pod documented
46 0 my $self = shift;
47 sprintf('t:%s',
48 0 join( '|', map { $_->as_string } @{ $self->dataset } ) )
49 }
50  
51 package # hide from PAUSE
52 Google::Chart::Data::Text::DataSet;
53 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
54 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
55  
56 subtype 'Google::Chart::Data::Text::DataSet::Value'
57 => as 'Num'
58 0 ▶ => where {
Subroutine __ANON__: not called CC=3 SCAR=24.8
59 0 ▶ ($_ >= 0 && $_ <= 100) || $_ == -1
Branch: 1 branch
BranchTrueFalseTotal
$_ >= 0 and $_ <= 100 or $_ == -1 0 0 0
Condition0%0/3
$_ >= 0 and $_ <= 100
!ll&&!rl&&r
000
MC/DC0%0/2
$_ >= 0 and $_ <= 100
$_ >= 0 $_ <= 100
Truth table0%0/3
A and B
A= $_ >= 0B= $_ <= 100
ABresult
0X0
100
111
60 }
61 1 ;
62  
63 has 'data' => (
64 is => 'rw',
65 isa => 'ArrayRef[Maybe[Google::Chart::Data::Text::DataSet::Value]]',
66 required => 1,
67 0 ▶ default => sub { +[] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
68 1 );
69  
70 1 __PACKAGE__->meta->make_immutable;
71
72 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
73 1 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
74  
75 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
76 0 my $self = shift;
77 0 return join(',', map { sprintf('%0.1f', $_) } @{$self->data});
78 }
79  
80 1 1;
81  
82 __END__
« Chart/Title.pm ↑ Summary Chart/Type/QRcode.pm »