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

filter: Statementstmt 40.6% 13 / 32 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 18 MC/DCmcdc 0.0% 0 / 9 Subroutinesub 50.0% 4 / 8 Podpod 0.0% 0 / 4 totaltotal 20.0% 17 / 85 CC 15 SCAR 49.0
CC
15
Cov
20%
process
210.0
verify
6.0
max_arguments
2.0
CRAP 134.5
« blib/lib/WWW/Shopify/Liquid/Operator/Concatenate.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Operator/Equals.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::Increment;
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 increment.") 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  
15 30 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
16 sub process {
17 0 ▶ my ($self, $hash, $action, $pipeline) = @_;
Subroutine process: not called CC=14 SCAR=53.5
Pod undocumented
18 0 ▶ my @vars = map { $self->is_processed($_) ? $_ : $_->$action($pipeline, $hash) } @{$self->{arguments}->[0]->{core}};
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($_) ? : 0 0 0
19
20 0 my $inner_hash = $hash;
21 0 for (0..$#vars-1) {
22 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
23 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
24 0 ▶ $inner_hash->[$vars[$_]] = {} if !defined $inner_hash->[$vars[$_]];
Branch: 1 branch
BranchTrueFalseTotal
unless defined $$inner_hash[$vars[$_]] 0 0 0
25 0 $inner_hash = $inner_hash->[$vars[$_]];
26 } else {
27 0 ▶ $inner_hash->{$vars[$_]} = {} if !exists $inner_hash->{$vars[$_]};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $$inner_hash{$vars[$_]} 0 0 0
28 0 $inner_hash = $inner_hash->{$vars[$_]};
29 }
30 }
31 0 ▶ if (exists $inner_hash->{$vars[-1]} && looks_like_number($inner_hash->{$vars[-1]})) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $$inner_hash{$vars[-1]} and &looks_like_number($$inner_hash{$vars[-1]})) 0 0 0
Condition0%0/3
exists $$inner_hash{$vars[-1]} and &looks_like_number($$inner_hash{$vars[-1]})
!ll&&!rl&&r
000
MC/DC0%0/2
exists $$inner_hash{$vars[-1]} and &looks_like_number($$inner_hash{$vars[-1]})
exists $$inner_hash{$vars[-1]} &looks_like_number($$inner_hash{$vars[-1]})
Truth table0%0/3
A and B
A= exists $$inner_hash{$vars[-1]}B= &looks_like_number($$inner_hash{$vars[-1]})
ABresult
0X0
100
111
32 0 $inner_hash->{$vars[-1]}++;
33 }
34 0 return '';
35
36 }
37  
38  
39  
40 30 1;
« blib/lib/WWW/Shopify/Liquid/Operator/Concatenate.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Operator/Equals.pm »