| 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
| |||||||||||||||||||||
| 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
| |||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 2 | ▶ | if (exists $args->{address}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 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
MC/DC0%0/2
$gateway ||= $self->_gateway
$gateway
$self->_gateway
Truth table66%2/3
A ||= B
A= $gatewayB= $self->_gateway
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 3 | return $gateway->account_address_class->new($addr); | |||||||||||||||||||
| 47 | } | ||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 2 | 1; | |||||||||||||||||||
| 50 | |||||||||||||||||||||
| 51 | __END__ | ||||||||||||||||||||