| 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 // {}
MC/DC100%1/1
$headers // {}
$headers
Truth table100%2/2
A
A= $headers
| |||||||||||||||||||||||||||||
| 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
Condition100%3/3
defined $content and length $content
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
| |||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||