| 1 | package Business::CPI::Role::Account::Address; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: Business::CPI role for Addresses | ||||||||||||||||||||||||||||
| 3 | 3 | ▶ | use Moo::Role; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 3 | ▶ | use utf8; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Business::CPI::Util::Types qw/Country/; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 3 | our $VERSION = '0.924'; # VERSION | |||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | # TODO: | ||||||||||||||||||||||||||||
| 10 | # move this to Business::CPI core | ||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 3 | has line1 => ( is => 'lazy' ); | |||||||||||||||||||||||||||
| 13 | 3 | has line2 => ( is => 'lazy' ); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 3 | has street => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 16 | 3 | has number => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 17 | 3 | has district => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 18 | 3 | has complement => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 19 | 3 | has zip_code => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 20 | 3 | has city => ( is => 'rw' ); | |||||||||||||||||||||||||||
| 21 | 3 | has state => ( is => 'rw' ); # TODO: compare against Brazilian UF's, if country eq br | |||||||||||||||||||||||||||
| 22 | 3 | has country => ( | |||||||||||||||||||||||||||
| 23 | is => 'rw', | ||||||||||||||||||||||||||||
| 24 | isa => Country, | ||||||||||||||||||||||||||||
| 25 | coerce => Country->coercion, | ||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 1 | ▶ | sub _build_line1 { | ||||||||||||||||||||||||||
|
Subroutine
_build_line1: called CC=9 SCAR=25.1
| |||||||||||||||||||||||||||||
| 29 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 1 | ▶ | my $street = $self->street || ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->street || ''
MC/DC0%0/1
$self->street || ''
$self->street
Truth table50%1/2
A
A= $self->street
| |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | my $number = $self->number || ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->number || ''
MC/DC0%0/1
$self->number || ''
$self->number
Truth table50%1/2
A
A= $self->number
| |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | my $compl = $self->complement || ''; | ||||||||||||||||||||||||||
|
Condition50%1/2
$self->complement || ''
MC/DC0%0/1
$self->complement || ''
$self->complement
Truth table50%1/2
A
A= $self->complement
| |||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | ▶ | return unless $street; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | return $street unless ($number || $compl); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$number or $compl
MC/DC0%0/2
$number or $compl
$number
$compl
Truth table33%1/3
A or B
A= $numberB= $compl
| |||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | 1 | ▶ | return "$street, $number" unless $compl; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 40 | 1 | ▶ | return "$street - $compl" unless $number; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||
| 42 | 1 | return "$street, $number - $compl"; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 1 | ▶ | sub _build_line2 { | ||||||||||||||||||||||||||
|
Subroutine
_build_line2: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 46 | 1 | my $self = shift; | |||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 1 | return $self->district; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 3 | 1; | |||||||||||||||||||||||||||
| 52 | |||||||||||||||||||||||||||||
| 53 | __END__ | ||||||||||||||||||||||||||||