Chart/Data/Simple.pm

filter: Statementstmt 59.5% 28 / 47 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 63.6% 7 / 11 Podpod 50.0% 1 / 2 totaltotal 50.7% 36 / 71 CC 6 SCAR 28.1
CC
6
Cov
50%
parameter_value
42.0
__ANON__
2.0
__ANON__
2.0
CRAP 16.6
« Chart/Type/QRcode.pm ↑ Summary Chart/Axis/Style.pm »
1 # $Id$
2  
3 package Google::Chart::Data::Simple;
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 with 'Google::Chart::Data';
8  
9 1 __PACKAGE__->meta->make_immutable;
10  
11 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 my @map = ('A'..'Z', 'a'..'z', 0..9);
14  
15 0 ▶sub parameter_value {
Subroutine parameter_value: not called CC=6 SCAR=37.4
Pod documented
16 0 my $self = shift;
17 0 my $max = $self->max_value;
18 0 my $size = @map - 1;
19  
20 0 my $result = '';
21 0 foreach my $data ($self->dataset) {
22 0 my $v = '_';
23 0 ▶ if (defined $data && looks_like_number($data)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $data and &looks_like_number($data)) 0 0 0
Condition0%0/3
defined $data and &looks_like_number($data)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $data and &looks_like_number($data)
defined $data &looks_like_number($data)
Truth table0%0/3
A and B
A= defined $dataB= &looks_like_number($data)
ABresult
0X0
100
111
24 0 my $index = int($data / $max * $size);
25  
26 0 ▶ if ($index < 0) {
Branch: 2 branches
BranchTrueFalseTotal
if ($index < 0) { } 0 0 0
elsif ($index > @map) { } 0 0 0
27 0 $index = 0;
28 } elsif ($index > @map) {
29 0 $index = $size;
30 }
31 0 $v = $map[$index];
32 }
33  
34 0 $result .= $v;
35 }
36 0 return $result;
37 }
38  
39 package # hide from PAUSE
40 Google::Chart::Data::Simple::DataSet;
41 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
43  
44 subtype 'Google::Chart::Data::Simple::DataSet::Value'
45 => as 'Num'
46 0 ▶ => where {
Subroutine __ANON__: not called CC=1 SCAR=6.9
47 0 /^[A-Za-z0-9\-\.]{2}$/
48 }
49 1 ;
50  
51 has 'data' => (
52 is => 'rw',
53 isa => 'ArrayRef[Maybe[Google::Chart::Data::Simple::DataSet::Value]]',
54 required => 1,
55 0 ▶ default => sub { +[] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
56 1 );
57  
58 1 __PACKAGE__->meta->make_immutable;
59
60 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 1 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
62  
63 0 ▶sub as_string {
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
64 0 my $self = shift;
65 0 return join(',', @{$self->data});
66 }
67  
68 1 1;
69  
70 __END__
« Chart/Type/QRcode.pm ↑ Summary Chart/Axis/Style.pm »