Auth/Offer.pm

filter: Statementstmt 40.6% 13 / 32 Branchbran 0.0% 0 / 2 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 40.0% 4 / 10 Podpod 0.0% 0 / 5 totaltotal 26.5% 17 / 64 SCAR 26.0
CC
5
Cov
30%
_process
20.0
new
6.0
offer
2.0
CRAP 13.5
« Auth/Utils.pm ↑ Summary Auth/ApplicationToken.pm »
1 package WWW::Live::Auth::Offer;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 1 ▶use WWW::Live::Auth::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 sub new {
10 0 ▶ my ( $proto, %args ) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
11 0 ▶ my $class = ref $proto || $proto;
Condition0%0/3
ref $proto || $proto
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
12 my $self = bless {
13 'offer' => $args{'offer'},
14 'action' => $args{'action'},
15 0 'expires' => $args{'expires'}
16 }, $class;
17 0 $self->_process;
18 0 return $self;
19 }
20  
21 sub offer {
22 0 ▶ my ( $self ) = @_;
Subroutine offer: not called CC=1 SCAR=6.9
Pod undocumented
23 0 return $self->{'offer'};
24 }
25  
26 sub action {
27 0 ▶ my ( $self ) = @_;
Subroutine action: not called CC=1 SCAR=6.9
Pod undocumented
28 0 return $self->{'action'};
29 }
30  
31 sub expires {
32 0 ▶ my ( $self ) = @_;
Subroutine expires: not called CC=1 SCAR=6.9
Pod undocumented
33 0 return $self->{'expires'};
34 }
35  
36 sub as_string {
37 0 ▶ my ( $self ) = @_;
Subroutine as_string: not called CC=1 SCAR=6.9
Pod undocumented
38 0 return $self->offer . '.' . $self->action;
39 }
40  
41 sub _process {
42 0 ▶ my ( $self ) = @_;
Subroutine _process: not called CC=4 SCAR=30.0
43 0 ▶ if ( !$self->{'action'} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{"action"}) 0 0 0
44 0 my ($offer, $action, $expires) = split /[\.:]/, $self->{'offer'};
45 0 ▶ $self->{'offer'} = $offer || croak('Could not parse offer');
Condition0%0/3
$offer || croak('Could not parse offer')
l!l&&r!l&&!r
000
MC/DC0%0/2
$offer || croak('Could not parse offer')
$offer croak('Could not parse offer')
Truth table0%0/3
A || B
A= $offerB= croak('Could not parse offer')
ABresult
1X1
011
000
46 0 ▶ $self->{'action'} = $action || croak('Could not parse offer action');
Condition0%0/3
$action || croak('Could not parse offer action')
l!l&&r!l&&!r
000
MC/DC0%0/2
$action || croak('Could not parse offer action')
$action croak('Could not parse offer action')
Truth table0%0/3
A || B
A= $actionB= croak('Could not parse offer action')
ABresult
1X1
011
000
47 0 $self->{'expires'}; # optional
48 }
49 }
50  
51 1 1;
52 __END__
« Auth/Utils.pm ↑ Summary Auth/ApplicationToken.pm »