Chart/Legend.pm

filter: Statementstmt 66.6% 26 / 39 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 45.4% 5 / 11 Podpod 100% 1 / 1 totaltotal 58.1% 32 / 55 CC 3 SCAR 13.7
CC
3
Cov
60%
as_query
12.0
__ANON__
2.0
__ANON__
2.0
CRAP 3.9
« Chart/Type/Bar.pm ↑ Summary Chart/QueryComponent/Simple.pm »
1 # $Id$
2  
3 package Google::Chart::Legend;
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use URI::Escape ();
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 with 'Google::Chart::QueryComponent';
9  
10 coerce 'Google::Chart::Legend'
11 => from 'HashRef'
12 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
13 0 Google::Chart::Legend->new(%{$_});
14 }
15 1 ;
16 coerce 'Google::Chart::Legend'
17 => from 'ArrayRef'
18 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 0 Google::Chart::Legend->new(values => $_);
20 }
21 1 ;
22  
23 coerce 'Google::Chart::Legend'
24 => from 'Str'
25 0 ▶ => via {
Subroutine __ANON__: not called CC=1 SCAR=6.9
26 0 Google::Chart::Legend->new(values => [$_])
27 }
28 1 ;
29  
30 1 subtype 'Google::Chart::Legend::Data'
31 => as 'Str'
32 ;
33  
34 1 subtype 'Google::Chart::Legend::DataList'
35 => as 'ArrayRef[Google::Chart::Legend::Data]',
36 ;
37  
38 coerce 'Google::Chart::Legend::DataList'
39 => from 'Str'
40 0 ▶ => via { [ $_ ] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
41 1 ;
42  
43 has 'values' => (
44 is => 'rw',
45 isa => 'Google::Chart::Legend::DataList',
46 coerce => 1,
47 required => 1,
48 0 ▶ default => sub { +[] }
Subroutine __ANON__: not called CC=1 SCAR=6.9
49 1 );
50  
51 1 has 'position' => (
52 is => 'rw',
53 isa => enum([ qw(b t r l) ]),
54 );
55  
56 1 __PACKAGE__->meta->make_immutable;
57  
58 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
59 1 ▶no Moose::Util::TypeConstraints;
Subroutine BEGIN: called CC=1 SCAR=0.0
60  
61 0 ▶sub as_query {
Subroutine as_query: not called CC=3 SCAR=24.8
Pod documented
62 0 my $self = shift;
63 my %data = (
64 0 chdl => join('|', @{ $self->values }),
65 );
66 0 ▶ if (my $position = $self->position) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $position = $self->position) 0 0 0
67 0 $data{chdlp} = $position;
68 }
69 return wantarray ? %data : join('&',
70 map {
71 0 ▶ join('=', URI::Escape::uri_escape($_), URI::Escape::uri_escape($data{$_}))
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 0 0 0
72 } keys %data
73 );
74 }
75  
76 1 1;
77  
78 __END__
« Chart/Type/Bar.pm ↑ Summary Chart/QueryComponent/Simple.pm »