BancaSella/Decode/Gateway.pm

filter: Statementstmt 96.1% 50 / 52 Branchbran 71.4% 10 / 14 Conditioncond 44.4% 4 / 9 MC/DCmcdc 16.6% 1 / 6 Subroutinesub 90.9% 10 / 11 Podpod 40.0% 2 / 5 totaltotal 79.3% 77 / 97 CC 12 SCAR 11.9
CC
12
Cov
85%
init
6.0
_split_uri
4.1
result
2.1
CRAP 3.3
« BancaSella/Encode/Gestpay.pm ↑ Summary BancaSella/Encode/Gateway.pm »
1 package Business::BancaSella::Decode::Gateway;
2  
3 2 push @ISA,'Business::BancaSella::Gateway';
4 2 ▶use Business::BancaSella::Gateway;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 2 ▶use URI;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 2 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8  
9 2 $VERSION = "0.11";
10 0 ▶sub Version { $VERSION; }
Subroutine Version: not called CC=1 SCAR=6.9
Pod undocumented
11 2 require 5.004;
12 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 2 my %fields =
16 (
17 query_string => undef
18 );
19
20 2 my @fields_req = qw/query_string/;
21
22 sub new
23 2 ▶{
Subroutine new: called CC=2 SCAR=7.1
Pod documented
24 2 my $proto = shift;
25 2 ▶ my $class = ref($proto) || $proto;
Condition33%1/3
ref $proto || $proto
l!l&&r!l&&!r
020
MC/DC0%0/2
ref $proto || $proto
ref $proto $proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
ABresult
1X1
011
000
26 2 my $self = {};
27 2 bless $self,$class;
28 2 $self->init(@_);
29 2 return $self;
30 }
31  
32 3 ▶sub init {
Subroutine init: called CC=6 SCAR=18.0
Pod undocumented
33 3 my $self = shift;
34 3 my (%options) = @_;
35 # Assign default options
36 3 ▶ while (my ($key,$value) = each(%fields)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %fields) 3 3 6
37 3 ▶ $self->{$key} = $self->{$key} || $value;
Condition66%2/3
$self->{$key} || $value
l!l&&r!l&&!r
102
MC/DC50%1/2
$self->{$key} || $value
$self->{$key} $value
Truth table66%2/3
A || B
A= $self->{$key}B= $value
ABresult
1X1
011
000
38 }
39 # Assign options
40 3 ▶ while (my ($key,$value) = each(%options)) {
Branch: 1 branch
BranchTrueFalseTotal
if (() = each %options) 4 3 7
41 4 $self->{$key} = $value;
42 }
43 # Check required params
44 3 foreach (@fields_req) {
45 croak "You must declare '$_' in " . ref($self) . "::new"
46 3 ▶ if (!defined $self->{$_});
Branch: 1 branch
BranchTrueFalseTotal
unless defined $self->{$_} 0 3 3
47 }
48 3 $self->_split_uri;
49 }
50  
51 3 ▶sub _split_uri {
Subroutine _split_uri: called CC=4 SCAR=14.1
52 3 my $self = shift;
53 3 my $qs = '?' . $self->query_string;
54 3 my %qs = URI->new($qs)->query_form;
55 die "Malformed uri definition: " . $self->{uri}
56 3 ▶ if (!(exists $qs{a} && exists $qs{b}));
Branch: 1 branch
BranchTrueFalseTotal
unless exists $qs{"a"} and exists $qs{"b"} 0 3 3
Condition33%1/3
exists $qs{"a"} and exists $qs{"b"}
!ll&&!rl&&r
003
MC/DC0%0/2
exists $qs{"a"} and exists $qs{"b"}
exists $qs{"a"} exists $qs{"b"}
Truth table33%1/3
A and B
A= exists $qs{"a"}B= exists $qs{"b"}
ABresult
0X0
100
111
57 3 $self->{result} = $qs{a};
58 3 $self->{id} = $qs{b};
59 3 $self->{otp} = $qs{c};
60 3 ▶ if ($self->{result} ne 'KO') {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"result"} ne "KO") 1 2 3
61 1 $self->{authcode} = $qs{a};
62 }
63
64 }
65  
66 5 ▶sub result {
Subroutine result: called CC=2 SCAR=7.6
Pod documented
67 5 my $self = shift;
68 0 ▶ if (@_) { $self->SUPER::result(shift) };
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 5 5
69 5 return $self->SUPER::result ne 'KO';
70 }
71  
72 3 ▶sub query_string { my $s=shift; return @_ ? ($s->{query_string}=shift) : $s->{query_string} }
Subroutine query_string: called CC=2 SCAR=7.2
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 0 3 3
73  
74 # Preloaded methods go here.
75  
76 2 1;
77 __END__
« BancaSella/Encode/Gestpay.pm ↑ Summary BancaSella/Encode/Gateway.pm »