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

filter: Statementstmt 55.5% 10 / 18 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 36.1% 13 / 36 CC 4 SCAR 22.7
CC
4
Cov
40%
operate
20.0
min_arguments
2.0
max_arguments
2.0
CRAP 9.7
« blib/lib/WWW/Shopify/Liquid/Exception.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Operator/Regex.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::DateMath;
6 30 ▶use base 'WWW::Shopify::Liquid::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 # +-, #, <unit>
8 0 ▶sub min_arguments { return 2; }
Subroutine min_arguments: not called CC=1 SCAR=6.9
Pod undocumented
9 0 ▶sub max_arguments { return 2; }
Subroutine max_arguments: not called CC=1 SCAR=6.9
Pod undocumented
10 sub operate {
11 0 ▶ my ($self, $hash, $operand, @arguments) = @_;
Subroutine operate: not called CC=4 SCAR=30.0
Pod undocumented
12 0 my ($number, $unit) = @arguments;
13 0 $unit = lc($unit);
14 0 ▶ return undef unless ref($operand) && ref($operand) eq "DateTime";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $operand and ref $operand eq "DateTime" 0 0 0
Condition0%0/3
ref $operand and ref $operand eq "DateTime"
!ll&&!rl&&r
000
MC/DC0%0/2
ref $operand and ref $operand eq "DateTime"
ref $operand ref $operand eq "DateTime"
Truth table0%0/3
A and B
A= ref $operandB= ref $operand eq "DateTime"
ABresult
0X0
100
111
15 0 ▶ return $operand unless $unit =~ m/^(days|months|years|weeks|seconds|minutes|hours)$/;
Branch: 1 branch
BranchTrueFalseTotal
unless $unit =~ /^(days|months|years|weeks|seconds|minutes|hours)$/ 0 0 0
16 0 return $operand->clone->add(
17 $unit => $number
18 );
19 }
20  
21 30 1;
« blib/lib/WWW/Shopify/Liquid/Exception.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Operator/Regex.pm »