Twilio/Http/Response.pm

filter: Statementstmt 100% 23 / 23 Branchbran 100% 2 / 2 Conditioncond 100% 5 / 5 MC/DCmcdc 100% 3 / 3 Subroutinesub 100% 9 / 9 Podpod 100% 6 / 6 totaltotal 100% 48 / 48 CC 4 SCAR 5.1
CC
4
Cov
100%
get_content
3.0
new
2.0
BEGIN
1.0
CRAP 1.7
« Twilio/Exceptions/RestExceptionV1.pm ↑ Summary Twilio/Rest/Intelligence/V3.pm »
1 package Twilio::Http::Response;
2  
3 24 ▶use 5.016;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 24 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 24 ▶use Twilio::Json;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 24 our $VERSION = '2.001';
9  
10 2053 ▶sub new {
Subroutine new: called CC=2 SCAR=6.9
Pod documented
11 2053 my ($class, $status_code, $content, $headers) = @_;
12 2053 ▶ return bless { status_code => $status_code, content => $content, headers => $headers // {} },
Condition100%2/2
$headers // {}
l!l
522001
MC/DC100%1/1
$headers // {}
$headers
Truth table100%2/2
A
A= $headers
Aresult
11
00
13 $class;
14 }
15  
16 2079 ▶sub get_status_code { return $_[0]{status_code} }
Subroutine get_status_code: called CC=1 SCAR=0.0
Pod documented
17 53 ▶sub get_headers { return $_[0]{headers} }
Subroutine get_headers: called CC=1 SCAR=0.0
Pod documented
18 2 ▶sub get_raw_content { return $_[0]{content} }
Subroutine get_raw_content: called CC=1 SCAR=0.0
Pod documented
19  
20 1707 ▶sub get_content {
Subroutine get_content: called CC=3 SCAR=11.0
Pod documented
21 1707 my ($self) = @_;
22 1707 my $content = $self->{content};
23 1707 ▶ return unless defined $content && length $content;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $content and length $content 2 1705 1707
Condition100%3/3
defined $content and length $content
!ll&&!rl&&r
111705
MC/DC100%2/2
defined $content and length $content
defined $content length $content
Truth table100%3/3
A and B
A= defined $contentB= length $content
ABresult
0X0
100
111
24  
25 # Gateways can answer with HTML, so a body that is not JSON is not an error here.
26 1705 my $decoded = eval { Twilio::Json::decode($content) };
27 1705 return $decoded;
28 }
29  
30 4 ▶sub ok {
Subroutine ok: called CC=1 SCAR=0.0
Pod documented
31 4 my ($self) = @_;
32 4 return $self->{status_code} < 400;
33 }
34  
35 24 1;
36  
37 __END__
« Twilio/Exceptions/RestExceptionV1.pm ↑ Summary Twilio/Rest/Intelligence/V3.pm »