blib/lib/WWW/Shopify/Liquid/Filter/DateParse.pm

filter: Statementstmt 64.0% 16 / 25 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 62.5% 5 / 8 Podpod 0.0% 0 / 3 totaltotal 52.5% 21 / 40 CC 3 SCAR 15.0
CC
3
Cov
55%
operate
12.0
min_arguments
2.0
max_arguments
2.0
CRAP 4.5
« blib/lib/WWW/Shopify/Liquid/Filter/MD5.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Security.pm »
1 #!/usr/bin/perl
2 30 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 30 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package WWW::Shopify::Liquid::Filter::DateParse;
6 30 ▶use base 'WWW::Shopify::Liquid::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 30 ▶use Date::Parse;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 30 ▶use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub min_arguments { return 0; }
Subroutine min_arguments: not called CC=1 SCAR=6.9
Pod undocumented
11 0 ▶sub max_arguments { return 1; }
Subroutine max_arguments: not called CC=1 SCAR=6.9
Pod undocumented
12 sub operate {
13 0 ▶ my ($self, $hash, $operand, $pattern) = @_;
Subroutine operate: not called CC=3 SCAR=24.8
Pod undocumented
14 0 ▶ if ($pattern) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pattern) 0 0 0
15 0 my $strp = DateTime::Format::Strptime->new(pattern => $pattern);
16 0 return $strp->parse_datetime($operand);
17 }
18 0 my $result = str2time($operand, "UTC");
19 0 ▶ return undef unless $result;
Branch: 1 branch
BranchTrueFalseTotal
unless $result 0 0 0
20 0 return DateTime->from_epoch( epoch => $result );
21 }
22  
23 30 1;
« blib/lib/WWW/Shopify/Liquid/Filter/MD5.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Security.pm »