| 1 | package PagSeguro::API::Base; | ||||||||||||||||||||||||||||
| 2 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use LWP::UserAgent; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use PagSeguro::API::Resource; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | sub new { | ||||||||||||||||||||||||||||
| 9 | 0 | ▶ | return bless {}, shift; | ||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 10 | } | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | # accessors | ||||||||||||||||||||||||||||
| 13 | sub resource { | ||||||||||||||||||||||||||||
| 14 | 2 | ▶ | my $self = shift; | ||||||||||||||||||||||||||
|
Subroutine
resource: called CC=3 SCAR=11.7
Pod
undocumented
| |||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||
| 16 | # return resources key | ||||||||||||||||||||||||||||
| 17 | 2 | my $res = PagSeguro::API::Resource->instance; | |||||||||||||||||||||||||||
| 18 | 2 | ▶ | return ($res->get($_[0]) || undef) if $_[0]; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$res->get($_[0]) || undef
MC/DC0%0/1
$res->get($_[0]) || undef
$res->get($_[0])
Truth table50%1/2
A
A= $res->get($_[0])
| |||||||||||||||||||||||||||||
| 19 | } | ||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | # method | ||||||||||||||||||||||||||||
| 22 | sub get { | ||||||||||||||||||||||||||||
| 23 | 0 | ▶ | my ($self, $url) = @_; | ||||||||||||||||||||||||||
|
Subroutine
get: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||
| 25 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||||||||
| 26 | 0 | ▶ | my $response = $ua->get($url) || undef; | ||||||||||||||||||||||||||
|
Condition0%0/2
$ua->get($url) || undef
MC/DC0%0/1
$ua->get($url) || undef
$ua->get($url)
Truth table0%0/2
A
A= $ua->get($url)
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | # success | ||||||||||||||||||||||||||||
| 29 | 0 | ▶ | return $response->decoded_content | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$response and $response->is_success
MC/DC0%0/2
$response and $response->is_success
$response
$response->is_success
Truth table0%0/3
A and B
A= $responseB= $response->is_success
| |||||||||||||||||||||||||||||
| 30 | if $response && $response->is_success | ||||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | sub post { | ||||||||||||||||||||||||||||
| 34 | 0 | ▶ | my ($self, $url, $params) = @_; | ||||||||||||||||||||||||||
|
Subroutine
post: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||
| 36 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||||||||
| 37 | 0 | ▶ | my $response = $ua->post($url, $params) || undef; | ||||||||||||||||||||||||||
|
Condition0%0/2
$ua->post($url, $params) || undef
MC/DC0%0/1
$ua->post($url, $params) || undef
$ua->post($url, $params)
Truth table0%0/2
A
A= $ua->post($url, $params)
| |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | # success | ||||||||||||||||||||||||||||
| 40 | 0 | ▶ | return $response->decoded_content | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$response and $response->is_success
MC/DC0%0/2
$response and $response->is_success
$response
$response->is_success
Truth table0%0/3
A and B
A= $responseB= $response->is_success
| |||||||||||||||||||||||||||||
| 41 | if $response && $response->is_success; | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | # error | ||||||||||||||||||||||||||||
| 44 | 0 | return $response->status_line; | |||||||||||||||||||||||||||
| 45 | } | ||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 6 | 1; | |||||||||||||||||||||||||||