Picnic/Result.pm

filter: Statementstmt 88.2% 15 / 17 Branchbran 50.0% 3 / 6 Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 100% 3 / 3 Podpod 0.0% 0 / 1 totaltotal 62.1% 23 / 37 CC 6 SCAR 19.8
CC
6
Cov
69%
BUILDARGS
9.3
BEGIN
1.0
_get
1.0
CRAP 7.2
« Picnic/Result/Search.pm ↑ Summary Picnic.pm »
1 package WWW::Picnic::Result;
2 2 our $VERSION = '0.100';
3 2 our $AUTHORITY = 'cpan:GETTY';
4 # ABSTRACT: Base class for Picnic API result objects
5  
6 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 2 has raw => (
10 is => 'ro',
11 required => 1,
12 );
13  
14  
15 sub BUILDARGS {
16 14 ▶ my ( $class, @args ) = @_;
Subroutine BUILDARGS: called CC=6 SCAR=22.3
Pod undocumented
17 14 ▶ if ( @args == 1 && ref $args[0] ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args == 1 and ref $args[0]) 14 0 14
Condition33%1/3
@args == 1 and ref $args[0]
!ll&&!rl&&r
0014
MC/DC0%0/2
@args == 1 and ref $args[0]
@args == 1 ref $args[0]
Truth table33%1/3
A and B
A= @args == 1B= ref $args[0]
ABresult
0X0
100
111
18 14 my $ref_type = ref $args[0];
19 # Accept both HASH and ARRAY as raw data
20 14 ▶ if ( $ref_type eq 'ARRAY' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref_type eq "ARRAY") 0 14 14
21 0 return { raw => $args[0] };
22 }
23 14 ▶ if ( $ref_type eq 'HASH' && !exists $args[0]->{raw} ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($ref_type eq "HASH" and not exists $args[0]{"raw"}) 14 0 14
Condition33%1/3
$ref_type eq "HASH" and not exists $args[0]{"raw"}
!ll&&!rl&&r
0014
MC/DC0%0/2
$ref_type eq "HASH" and not exists $args[0]{"raw"}
$ref_type eq "HASH" not exists $args[0]{"raw"}
Truth table33%1/3
A and not(B)
A= $ref_type eq "HASH"B= not exists $args[0]{"raw"}
ABresult
0X0
100
111
24 14 return { raw => $args[0] };
25 }
26 }
27 0 return $class->SUPER::BUILDARGS(@args);
28 }
29  
30 sub _get {
31 36 ▶ my ( $self, $key ) = @_;
Subroutine _get: called CC=1 SCAR=0.0
32 36 return $self->raw->{$key};
33 }
34  
35 2 1;
36  
37 __END__
« Picnic/Result/Search.pm ↑ Summary Picnic.pm »