blib/lib/WWW/Shopify/Liquid/Tag/Decrement.pm

filter: Statementstmt 40.6% 13 / 32 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 21.2% 17 / 80 CC 14 SCAR 47.3
CC
14
Cov
21%
process
182.0
verify
6.0
max_arguments
2.0
CRAP 113.6
« blib/lib/WWW/Shopify/Liquid/Operator/NotEquals.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Filter/JSON.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::Tag::Decrement;
6 30 ▶use base 'WWW::Shopify::Liquid::Tag::Free';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 0 ▶sub max_arguments { return 1; }
Subroutine max_arguments: not called CC=1 SCAR=6.9
Pod undocumented
8 0 ▶sub min_arguments { return 1; }
Subroutine min_arguments: not called CC=1 SCAR=6.9
Pod undocumented
9 sub verify {
10 0 ▶ my ($self) = @_;
Subroutine verify: not called CC=2 SCAR=17.9
Pod undocumented
11 die new WWW::Shopify::Liquid::Exception::Parser::Arguments($self, "Requires variable to decrement.") unless
12 0 ▶ $self->{arguments}->[0]->isa('WWW::Shopify::Liquid::Token::Variable');
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"arguments"}[0]->isa("WWW::Shopify::Liquid::Token::Variable") 0 0 0
13 }
14 30 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 sub process {
16 0 ▶ my ($self, $hash, $action, $pipeline) = @_;
Subroutine process: not called CC=13 SCAR=52.0
Pod undocumented
17 0 ▶ my @vars = map { $self->is_processed($_) ? $_ : $_->$action($pipeline, $hash) } @{$self->{arguments}->[0]->{core}};
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($_) ? : 0 0 0
18
19 0 my $inner_hash = $hash;
20 0 for (0..$#vars-1) {
21 0 ▶ return $self if ref($inner_hash) && ref($inner_hash) eq "HASH" && !exists $inner_hash->{$vars[$_]} && $action eq 'optimize';
Branch: 1 branch
BranchTrueFalseTotal
if ref $inner_hash and ref $inner_hash eq "HASH" and not exists $$inner_hash{$vars[$_]} and $action eq "optimize" 0 0 0
Condition0%0/9
ref $inner_hash and ref $inner_hash eq "HASH" and not exists $$inner_hash{$vars[$_]} and $action eq "optimize"
!ll&&!rl&&r
000
ref $inner_hash and ref $inner_hash eq "HASH" and not exists $$inner_hash{$vars[$_]}
!ll&&!rl&&r
000
ref $inner_hash and ref $inner_hash eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/4
ref $inner_hash and ref $inner_hash eq "HASH" and not exists $$inner_hash{$vars[$_]} and $action eq "optimize"
ref $inner_hash ref $inner_hash eq "HASH" not exists $$inner_hash{$vars[$_]} $action eq "optimize"
Truth table0%0/5
A and B and not(C) and D
A= ref $inner_hashB= ref $inner_hash eq "HASH"C= not exists $$inner_hash{$vars[$_]}D= $action eq "optimize"
ABCDresult
0XXX0
10XX0
110X0
11100
11111
22 0 ▶ if (looks_like_number($vars[$_]) && ref($inner_hash) && ref($inner_hash) eq "ARRAY") {
Branch: 1 branch
BranchTrueFalseTotal
if (&looks_like_number($vars[$_]) and ref $inner_hash and ref $inner_hash eq 'ARRAY') { } 0 0 0
Condition0%0/6
&looks_like_number($vars[$_]) and ref $inner_hash and ref $inner_hash eq "ARRAY"
!ll&&!rl&&r
000
&looks_like_number($vars[$_]) and ref $inner_hash
!ll&&!rl&&r
000
MC/DC0%0/3
&looks_like_number($vars[$_]) and ref $inner_hash and ref $inner_hash eq "ARRAY"
&looks_like_number($vars[$_]) ref $inner_hash ref $inner_hash eq "ARRAY"
Truth table0%0/4
A and B and C
A= &looks_like_number($vars[$_])B= ref $inner_hashC= ref $inner_hash eq "ARRAY"
ABCresult
0XX0
10X0
1100
1111
23 0 ▶ $inner_hash->[$vars[$_]] = {} if !defined $inner_hash->[$vars[$_]];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$inner_hash[$vars[$_]] 0 0 0
24 0 $inner_hash = $inner_hash->[$vars[$_]];
25 } else {
26 0 ▶ $inner_hash->{$vars[$_]} = {} if !exists $inner_hash->{$vars[$_]};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $$inner_hash{$vars[$_]} 0 0 0
27 0 $inner_hash = $inner_hash->{$vars[$_]};
28 }
29 }
30 0 ▶ if (looks_like_number($inner_hash->{$vars[-1]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (&looks_like_number($$inner_hash{$vars[-1]})) 0 0 0
31 0 $inner_hash->{$vars[-1]}--;
32 }
33 0 return '';
34
35 }
36  
37  
38  
39 30 1;
« blib/lib/WWW/Shopify/Liquid/Operator/NotEquals.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Filter/JSON.pm »