blib/lib/Date/Holidays/Adapter/ES.pm

filter: Statementstmt 30.9% 17 / 55 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 71.4% 5 / 7 Podpod 100% 2 / 2 totaltotal 27.2% 24 / 88 CC 11 SCAR 34.0
CC
11
Cov
23%
holidays
42.0
is_holiday
42.0
BEGIN
1.0
CRAP 29.9
« lib/Date/Holidays.pm ↑ Summary blib/lib/Date/Holidays/Adapter/NZ.pm »
1 package Date::Holidays::Adapter::ES;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use base 'Date::Holidays::Adapter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use Module::Load; # load
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 2 ▶use vars qw($VERSION);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 $VERSION = '1.35';
12  
13 0 ▶sub holidays {
Subroutine holidays: not called CC=6 SCAR=37.4
Pod documented
14 0 my ($self, %params) = @_;
15  
16 0 my $dh = $self->{_adaptee}->new();
17  
18 0 my $holidays_es_hashref = {};
19 0 my $holidays_ca_es_hashref = {};
20  
21 0 ▶ if ($dh) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dh) { } 0 0 0
22 0 $holidays_es_hashref = $dh->holidays(year => $params{year});
23  
24 0 ▶ if ($params{region} and $params{region} eq 'ca') {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"region"} and $params{"region"} eq "ca") 0 0 0
Condition0%0/3
$params{"region"} and $params{"region"} eq "ca"
!ll&&!rl&&r
000
MC/DC0%0/2
$params{"region"} and $params{"region"} eq "ca"
$params{"region"} $params{"region"} eq "ca"
Truth table0%0/3
A and B
A= $params{"region"}B= $params{"region"} eq "ca"
ABresult
0X0
100
111
25  
26 0 eval { load 'Date::Holidays::CA_ES'; }; # From Module::Load
27 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
28 0 warn "Unable to load: Date::Holidays::CA_ES - $@\n";
29 0 return $holidays_es_hashref;
30 }
31  
32 0 my $dh_ca_es = Date::Holidays::CA_ES->new();
33 0 $holidays_ca_es_hashref = $dh_ca_es->holidays(year => $params{year});
34 }
35 } else {
36 0 return;
37 }
38  
39 0 foreach my $key (keys %{$holidays_ca_es_hashref}) {
40 0 $holidays_es_hashref->{$key} = $holidays_ca_es_hashref->{$key};
41 }
42  
43 0 return $holidays_es_hashref;
44 }
45  
46 0 ▶sub is_holiday {
Subroutine is_holiday: not called CC=6 SCAR=37.4
Pod documented
47 0 my ($self, %params) = @_;
48  
49 0 my $dh = $self->{_adaptee}->new();
50  
51 0 ▶ if ($dh) {
Branch: 1 branch
BranchTrueFalseTotal
if ($dh) { } 0 0 0
52 0 my $holiday = $dh->is_holiday(year => $params{year}, month => $params{month}, day => $params{day});
53  
54 0 ▶ if ($params{region} and $params{region} eq 'ca') {
Branch: 1 branch
BranchTrueFalseTotal
if ($params{"region"} and $params{"region"} eq "ca") 0 0 0
Condition0%0/3
$params{"region"} and $params{"region"} eq "ca"
!ll&&!rl&&r
000
MC/DC0%0/2
$params{"region"} and $params{"region"} eq "ca"
$params{"region"} $params{"region"} eq "ca"
Truth table0%0/3
A and B
A= $params{"region"}B= $params{"region"} eq "ca"
ABresult
0X0
100
111
55  
56 0 eval { load 'Date::Holidays::CA_ES'; }; # From Module::Load
57 0 ▶ if ($@) {
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
58 0 warn "Unable to load: Date::Holidays::CA_ES - $@\n";
59 0 return $holiday;
60 }
61  
62 0 my $dh_ca_es = Date::Holidays::CA_ES->new();
63  
64 0 my $holidays = $dh_ca_es->holidays(year => $params{year}, region => $params{region});
65  
66 0 my $holiday_date = sprintf('%02s%02s', $params{month}, $params{day});
67  
68 0 $holiday = $holidays->{$holiday_date};
69  
70 0 ▶ if ($holiday) {
Branch: 1 branch
BranchTrueFalseTotal
if ($holiday) { } 0 0 0
71 0 return $holiday;
72 } else {
73 0 return '';
74 }
75 }
76  
77 0 return $holiday
78 } else {
79 0 return '';
80 }
81 }
82  
83 2 1;
84  
85 __END__
« lib/Date/Holidays.pm ↑ Summary blib/lib/Date/Holidays/Adapter/NZ.pm »