Closure/Types.pm

filter: Statementstmt 81.4% 44 / 54 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 55.5% 10 / 18 Podpod n/a totaltotal 75.0% 54 / 72 CC 1 SCAR 0.7
CC
1
Cov
81%
__ANON__
1.3
__ANON__
1.3
__ANON__
1.1
CRAP 1.1
« Closure/Response.pm ↑ Summary Closure/Type/Error.pm »
1 package WebService::Google::Closure::Types;
2  
3 use MooseX::Types
4 3 ▶ -declare => [
Subroutine BEGIN: called CC=1 SCAR=0.0
5 qw(
6 Stats
7 Warning
8 Error
9 ArrayRefOfWarnings
10 ArrayRefOfErrors
11 ArrayRefOfStrings
12 CompilationLevel
13 )
14 3 ];
15  
16 3 ▶use MooseX::Types::Moose qw( ArrayRef HashRef Str Int Undef );
Subroutine BEGIN: called CC=1 SCAR=0.0
17 3 ▶use Perl6::Junction qw( any );
Subroutine BEGIN: called CC=1 SCAR=0.0
18 3 ▶use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
19  
20 3 ▶use WebService::Google::Closure::Type::Warning;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 3 ▶use WebService::Google::Closure::Type::Error;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 3 ▶use WebService::Google::Closure::Type::Stats;
Subroutine BEGIN: called CC=1 SCAR=0.0
23  
24 3 subtype ArrayRefOfStrings,
25 as ArrayRef[Str];
26  
27 coerce ArrayRefOfStrings,
28 from Str,
29 0 ▶ via { [ $_ ] };
Subroutine __ANON__: not called CC=1 SCAR=1.2
30  
31 3 my $level = {
32 NOOP => 0,
33 WHITESPACE_ONLY => 1,
34 SIMPLE_OPTIMIZATIONS => 2,
35 ADVANCED_OPTIMIZATIONS => 3,
36 };
37  
38 subtype CompilationLevel,
39 as Str,
40 4 ▶ where { any( keys(%$level) ) eq $_ },
Subroutine __ANON__: called CC=1 SCAR=0.0
41 0 ▶ message { "Illegal compilation level" };
Subroutine __ANON__: not called CC=1 SCAR=1.2
42  
43 coerce CompilationLevel,
44 from Int,
45 2 ▶ via { my $in = $_; [ grep { $in == $level->{ $_ } } keys( %$level ) ]->[0] };
Subroutine __ANON__: called CC=1 SCAR=0.0
46  
47 coerce CompilationLevel,
48 from Str,
49 0 ▶ via { uc $_ };
Subroutine __ANON__: not called CC=1 SCAR=1.2
50  
51 coerce CompilationLevel,
52 from Undef,
53 0 ▶ via { 'SIMPLE_OPTIMIZATIONS' };
Subroutine __ANON__: not called CC=1 SCAR=1.2
54  
55 3 class_type Warning,
56 { class => 'WebService::Google::Closure::Type::Warning' };
57  
58 coerce Warning,
59 from HashRef,
60 0 ▶ via { WebService::Google::Closure::Type::Warning->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
61  
62 3 class_type Error,
63 { class => 'WebService::Google::Closure::Type::Error' };
64  
65 coerce Error,
66 from HashRef,
67 0 ▶ via { WebService::Google::Closure::Type::Error->new( $_ ) };
Subroutine __ANON__: not called CC=1 SCAR=1.2
68  
69 3 subtype ArrayRefOfWarnings,
70 as ArrayRef[Warning];
71  
72 coerce ArrayRefOfWarnings,
73 from ArrayRef[HashRef],
74 0 ▶ via { [ map { to_Warning( $_ ) } @$_ ] };
Subroutine __ANON__: not called CC=1 SCAR=2.6
75  
76 3 subtype ArrayRefOfErrors,
77 as ArrayRef[Error];
78  
79 coerce ArrayRefOfErrors,
80 from ArrayRef[HashRef],
81 0 ▶ via { [ map { to_Error( $_ ) } @$_ ] };
Subroutine __ANON__: not called CC=1 SCAR=2.6
82  
83 3 class_type Stats,
84 { class => 'WebService::Google::Closure::Type::Stats' };
85  
86 coerce Stats,
87 from HashRef,
88 1 ▶ via { WebService::Google::Closure::Type::Stats->new( $_ ) };
Subroutine __ANON__: called CC=1 SCAR=0.0
89  
90 3 1;
« Closure/Response.pm ↑ Summary Closure/Type/Error.pm »