blib/lib/WWW/Google/Cloud/Messaging/Response.pm

filter: Statementstmt 57.1% 28 / 49 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 50.0% 8 / 16 Podpod 75.0% 3 / 4 totaltotal 52.7% 39 / 74 CC 3 SCAR 8.5
CC
3
Cov
53%
new
6.0
results
6.0
http_response
2.0
CRAP 2.3
« blib/lib/WWW/Google/Cloud/Messaging/Response/ResultSet.pm ↑ Summary _build/lib/MyBuilder.pm »
1 package WWW::Google::Cloud::Messaging::Response;
2  
3 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 3 ▶use JSON qw(decode_json);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 3 ▶use WWW::Google::Cloud::Messaging::Response::ResultSet;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub new {
10 0 ▶ my ($class, $http_response) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
11  
12 0 my $is_success = $http_response->is_success;
13 0 my $content = $http_response->content;
14 0 my $reg_ids = [];
15  
16 0 ▶ if ($is_success) {
Branch: 1 branch
BranchTrueFalseTotal
if ($is_success) { } 0 0 0
17 0 $content = decode_json $content;
18 0 $reg_ids = decode_json($http_response->request->content)->{registration_ids};
19 }
20 else {
21 0 $content = { error => $content };
22 }
23  
24 0 bless {
25 is_success => $is_success,
26 content => $content,
27 reg_ids => $reg_ids,
28 http_response => $http_response,
29 }, $class;
30 }
31  
32 sub http_response {
33 0 ▶ shift->{http_response};
Subroutine http_response: not called CC=1 SCAR=6.9
Pod undocumented
34 }
35  
36 sub is_success {
37 0 ▶ shift->{is_success};
Subroutine is_success: not called CC=1 SCAR=6.9
Pod documented
38 }
39  
40 3 for my $method (qw{success failure multicast_id canonical_ids error}) {
41 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
42 15 *{$method} = sub {
43 3 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 0 ▶ shift->{content}{$method};
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 15 };
46 }
47  
48 sub results {
49 0 ▶ my $self = shift;
Subroutine results: not called CC=2 SCAR=17.9
Pod documented
50 0 ▶ my $results = $self->{content}{results} || return;
Condition0%0/2
$self->{'content'}{'results'} || (return)
l!l
00
MC/DC0%0/1
$self->{'content'}{'results'} || (return)
$self->{'content'}{'results'}
Truth table0%0/2
A
A= $self->{'content'}{'results'}
Aresult
11
00
51 0 WWW::Google::Cloud::Messaging::Response::ResultSet->new($results, $self->{reg_ids});
52 }
53  
54 ▶sub DESTROY {}
Subroutine DESTROY: not called CC=1 SCAR=0.0
55 sub AUTOLOAD {
56 0 ▶ (my $method = our $AUTOLOAD) =~ s/.*:://;
Subroutine AUTOLOAD: not called CC=1 SCAR=1.2
57 3 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
58 0 *{$AUTOLOAD} = sub {
59 3 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
60 0 ▶ my $self = shift;
Subroutine __ANON__: not called CC=1 SCAR=6.9
61 0 $self->{http_response}->$method(@_);
62 0 };
63 0 goto &$AUTOLOAD;
64 }
65  
66 3 1;
67 __END__
« blib/lib/WWW/Google/Cloud/Messaging/Response/ResultSet.pm ↑ Summary _build/lib/MyBuilder.pm »