Bankwest/Transaction.pm

filter: Statementstmt 100% 51 / 51 Branchbran 100% 8 / 8 Conditioncond 88.8% 8 / 9 MC/DCmcdc 83.3% 5 / 6 Subroutinesub 100% 17 / 17 Podpod n/a totaltotal 97.8% 89 / 91 CC 10 SCAR 13.5
CC
10
Cov
99%
__ANON__
9.0
__ANON__
2.0
BEGIN
1.0
CRAP 3.8
« Bankwest/Parser/TransactionSearch.pm ↑ Summary Bankwest/SessionFromLogin.pm »
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
BranchTrueFalseTotal
unless defined $self->$_ or defined $other->$_ 8 40 48
Condition100%3/3
defined $self->$_ or defined $other->$_
l!l&&r!l&&!r
3828
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->$_
ABresult
1X1
011
000
43 40 ▶ return if defined $self->$_ and not defined $other->$_;
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->$_ and not defined $other->$_ 4 36 40
Condition100%3/3
defined $self->$_ and not defined $other->$_
!ll&&!rl&&r
2344
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->$_
ABresult
0X0
100
111
44 36 ▶ return if defined $other->$_ and not defined $self->$_;
Branch: 1 branch
BranchTrueFalseTotal
if defined $other->$_ and not defined $self->$_ 2 34 36
Condition66%2/3
defined $other->$_ and not defined $self->$_
!ll&&!rl&&r
0342
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->$_
ABresult
0X0
100
111
45 34 ▶ return if $self->$_ ne $other->$_;
Branch: 1 branch
BranchTrueFalseTotal
if $self->$_ ne $other->$_ 6 28 34
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__
« Bankwest/Parser/TransactionSearch.pm ↑ Summary Bankwest/SessionFromLogin.pm »