| 1 | package Finance::Bank::Bankwest::Transaction; | ||||||||||||||||||||||||||||
| 2 | # ABSTRACT: representation of an account transaction | ||||||||||||||||||||||||||||
| 3 | 12 | $Finance::Bank::Bankwest::Transaction::VERSION = '1.2.8'; | |||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | ## no critic (RequireUseStrict, RequireUseWarnings, RequireEndWithOne) | ||||||||||||||||||||||||||||
| 6 | 12 | ▶ | use MooseX::Declare; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 12 | ▶ | class Finance::Bank::Bankwest::Transaction is dirty { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 12 | ▶ | use MooseX::StrictConstructor; # no exports | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 12 | for ( | |||||||||||||||||||||||||||
| 12 | [ date => 'Str' ], | ||||||||||||||||||||||||||||
| 13 | [ narrative => 'Str' ], | ||||||||||||||||||||||||||||
| 14 | [ cheque_num => 'Maybe[Str]' ], | ||||||||||||||||||||||||||||
| 15 | [ amount => 'Maybe[Num]' ], | ||||||||||||||||||||||||||||
| 16 | [ type => 'Maybe[Str]' ], | ||||||||||||||||||||||||||||
| 17 | ) { | ||||||||||||||||||||||||||||
| 18 | 60 | my ($attr, $type) = @$_; | |||||||||||||||||||||||||||
| 19 | 60 | has $attr => ( isa => $type, is => 'ro', required => 1 ); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 12 | has 'date_dt' => ( | |||||||||||||||||||||||||||
| 23 | init_arg => undef, | ||||||||||||||||||||||||||||
| 24 | isa => 'DateTime', | ||||||||||||||||||||||||||||
| 25 | is => 'ro', | ||||||||||||||||||||||||||||
| 26 | lazy_build => 1, | ||||||||||||||||||||||||||||
| 27 | ); | ||||||||||||||||||||||||||||
| 28 | 12 | ▶ | method _build_date_dt { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 29 | 1 | require DateTime; | |||||||||||||||||||||||||||
| 30 | 1 | my ($dd, $mm, $yyyy) | |||||||||||||||||||||||||||
| 31 | = shift->date =~ m( ^ (\d\d) / (\d\d) / (\d\d\d\d) $ )x; | ||||||||||||||||||||||||||||
| 32 | 1 | return DateTime->new( | |||||||||||||||||||||||||||
| 33 | day => $dd, | ||||||||||||||||||||||||||||
| 34 | month => $mm, | ||||||||||||||||||||||||||||
| 35 | year => $yyyy, | ||||||||||||||||||||||||||||
| 36 | ); | ||||||||||||||||||||||||||||
| 37 | 12 | } | |||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 12 | ▶ | method equals(Finance::Bank::Bankwest::Transaction $other) { | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=9 SCAR=22.0
| |||||||||||||||||||||||||||||
| 41 | 14 | for (qw{ date narrative cheque_num amount type }) { | |||||||||||||||||||||||||||
| 42 | 48 | ▶ | next if not defined $self->$_ and not defined $other->$_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->$_ or defined $other->$_
MC/DC100%2/2
defined $self->$_ or defined $other->$_
defined $self->$_
defined $other->$_
Truth table100%3/3
A or B
A= defined $self->$_B= defined $other->$_
| |||||||||||||||||||||||||||||
| 43 | 40 | ▶ | return if defined $self->$_ and not defined $other->$_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
defined $self->$_ and not defined $other->$_
MC/DC100%2/2
defined $self->$_ and not defined $other->$_
defined $self->$_
not defined $other->$_
Truth table100%3/3
A and not(B)
A= defined $self->$_B= not defined $other->$_
| |||||||||||||||||||||||||||||
| 44 | 36 | ▶ | return if defined $other->$_ and not defined $self->$_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $other->$_ and not defined $self->$_
MC/DC50%1/2
defined $other->$_ and not defined $self->$_
defined $other->$_
not defined $self->$_
Truth table66%2/3
A and not(B)
A= defined $other->$_B= not defined $self->$_
| |||||||||||||||||||||||||||||
| 45 | 34 | ▶ | return if $self->$_ ne $other->$_; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | 2 | return 1; | |||||||||||||||||||||||||||
| 48 | 12 | } | |||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 12 | ▶ | clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 51 | 12 | ▶ | use overload 'eq' => sub { shift->equals(shift) }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 52 | 12 | ▶ | use overload 'ne' => sub { not shift->equals(shift) }; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 53 | 12 | ▶ | } | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 54 | |||||||||||||||||||||||||||||
| 55 | __END__ | ||||||||||||||||||||||||||||