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
« lib/WWW/Shopify/Liquid/Analyzer.pm ↑ Summary lib/WWW/Shopify/Liquid/Security.pm »
1 #!/usr/bin/perl
2 38 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 38 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package WWW::Shopify::Liquid::Filter::DateParse;
6 38 ▶use base 'WWW::Shopify::Liquid::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 38 ▶use Date::Parse;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 38 ▶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 0 ▶sub operate {
Subroutine operate: not called CC=3 SCAR=24.8
Pod undocumented
13 0 my ($self, $hash, $operand, $pattern) = @_;
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, time_zone => "floating" );
21 }
22  
23 38 1;
« lib/WWW/Shopify/Liquid/Analyzer.pm ↑ Summary lib/WWW/Shopify/Liquid/Security.pm »