| 1 | package WWW::Google::Cloud::Messaging::Response; | ||||||||||||
| 2 | |||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 5 | 4 | ▶ | use JSON qw(decode_json); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 6 | |||||||||||||
| 7 | 4 | ▶ | 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
| |||||||||||||
| 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 | 4 | for my $method (qw{success failure multicast_id canonical_ids error}) { | |||||||||||
| 41 | 4 | ▶ | no strict 'refs'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 42 | 20 | *{$method} = sub { | |||||||||||
| 43 | 4 | ▶ | 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 | 20 | }; | |||||||||||
| 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)
MC/DC0%0/1
$self->{'content'}{'results'} || (return)
$self->{'content'}{'results'}
Truth table0%0/2
A
A= $self->{'content'}{'results'}
| |||||||||||||
| 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 | 4 | ▶ | no strict 'refs'; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 58 | 0 | *{$AUTOLOAD} = sub { | |||||||||||
| 59 | 4 | ▶ | 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 | 4 | 1; | |||||||||||
| 67 | __END__ | ||||||||||||