CPI/Role/Account/Business.pm

filter: Statementstmt 100% 30 / 30 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 91.3% 42 / 46 CC 5 SCAR 7.5
CC
5
Cov
95%
__ANON__
3.0
_inflate_address
2.0
__ANON__
2.0
CRAP 2.1
« CPI/Role/Cart.pm ↑ Summary CPI.pm »
1 package Business::CPI::Role::Account::Business;
2 # ABSTRACT: Business::CPI representation of corporations
3 2 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 our $VERSION = '0.924'; # VERSION
7  
8 2 has _gateway => ( is => 'ro', required => 1 );
9  
10 2 has corporate_name => ( is => 'rw' );
11 2 has trading_name => ( is => 'rw' );
12 2 has phone => ( is => 'rw' );
13  
14 2 has address => ( is => 'rw' );
15  
16 5 ▶around address => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
17 5 my $orig = shift;
18 5 my $self = shift;
19  
20 5 ▶ if (my $new_address = shift) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $new_address = shift()) 1 4 5
21 1 return $self->$orig( $self->_inflate_address($new_address) );
22 }
23  
24 4 return $self->$orig();
25 2 };
26  
27 3 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
28 3 my $orig = shift;
29 3 my $class = shift;
30 3 my $args = $class->$orig(@_);
31  
32 3 ▶ return $args if !$args->{_gateway};
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{"_gateway"} 1 2 3
33  
34 2 ▶ if (exists $args->{address}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"address"}) 2 0 2
35 2 $args->{address} = $class->_inflate_address($args->{address}, $args->{_gateway});
36 }
37  
38 2 return $args;
39 2 };
40  
41 3 ▶sub _inflate_address {
Subroutine _inflate_address: called CC=2 SCAR=7.0
42 3 my ($self, $addr, $gateway) = @_;
43  
44 3 ▶ $gateway ||= $self->_gateway;
Condition66%2/3
$gateway ||= $self->_gateway
l!l&&r!l&&!r
210
MC/DC0%0/2
$gateway ||= $self->_gateway
$gateway $self->_gateway
Truth table66%2/3
A ||= B
A= $gatewayB= $self->_gateway
ABresult
1X1
011
000
45  
46 3 return $gateway->account_address_class->new($addr);
47 }
48  
49 2 1;
50  
51 __END__
« CPI/Role/Cart.pm ↑ Summary CPI.pm »