blib/lib/Thunderhorse/Response.pm

filter: Statementstmt 100% 18 / 18 Branchbran 83.3% 5 / 6 Conditioncond 33.3% 3 / 9 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 7 / 7 Podpod 100% 3 / 3 totaltotal 76.6% 36 / 47 CC 7 SCAR 12.8
CC
7
Cov
79%
_allows_empty_body
7.5
is_ready
3.0
FOREIGNBUILDARGS
2.1
CRAP 3.6
« blib/lib/Gears/Template/TT.pm ↑ Summary blib/lib/Thunderhorse/Router/Location.pm »
1 package Thunderhorse::Response;
2 24 $Thunderhorse::Response::VERSION = '0.107';
3 24 ▶use v5.40;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 24 ▶use Mooish::Base -standard;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 24 ▶use Gears::X::Thunderhorse;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 24 extends 'PAGI::Response';
9 24 with 'Thunderhorse::Message';
10  
11 111 ▶sub FOREIGNBUILDARGS ($class, %args)
Subroutine FOREIGNBUILDARGS: called CC=2 SCAR=7.2
Pod documented
12 {
13 Gears::X::Thunderhorse->raise('no context for response')
14 111 ▶ unless $args{context};
Branch: 1 branch
BranchTrueFalseTotal
unless $args{"context"} 0 111 111
15  
16 111 return ($args{context}->pagi->[0]);
17 }
18  
19 106 ▶sub update ($self, $scope, $receive, $send)
Subroutine update: called CC=1 SCAR=0.0
Pod documented
20 {
21 106 $self->{scope} = $scope;
22 }
23  
24 1 ▶sub _allows_empty_body ($self, $status)
Subroutine _allows_empty_body: called CC=4 SCAR=20.1
25 {
26 # HTTP protocol hardcodes - these statuses can have empty bodies
27 1 ▶ return $status < 200
Condition33%3/9
$status < 200 || $status == 204 || $status >= 300 && $status < 400
l!l&&r!l&&!r
001
$status < 200 or $status == 204
l!l&&r!l&&!r
001
$status >= 300 and $status < 400
!ll&&!rl&&r
100
MC/DC0%0/4
$status < 200 || $status == 204 || $status >= 300 && $status < 400
$status < 200 $status == 204 $status >= 300 $status < 400
Truth table20%1/5
A or B || C and D
A= $status < 200B= $status == 204C= $status >= 300D= $status < 400
ABCDresult
1XXX1
01XX1
00111
000X0
00100
28 || $status == 204
29 || ($status >= 300 && $status < 400);
30 }
31  
32 203 ▶sub is_ready ($self)
Subroutine is_ready: called CC=3 SCAR=11.0
Pod documented
33 {
34 203 ▶ return true if $self->has_body_source;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_body_source 84 119 203
35  
36 119 ▶ return $self->_allows_empty_body($self->status)
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_status 1 118 119
37 if $self->has_status;
38  
39 118 return false;
40 }
41  
42 __END__
« blib/lib/Gears/Template/TT.pm ↑ Summary blib/lib/Thunderhorse/Router/Location.pm »