lib/WWW/Shopify/Liquid/Token.pm

filter: Statementstmt 35.2% 67 / 190 Branchbran 0.0% 0 / 56 Conditioncond 0.0% 0 / 78 MC/DCmcdc 0.0% 0 / 41 Subroutinesub 41.5% 22 / 53 Podpod 0.0% 0 / 3 totaltotal 21.1% 89 / 421 CC 60 SCAR 50.4
CC
60
Cov
21%
process
600.0
new
132.0
process
90.0
CRAP 154.1
« lib/WWW/Shopify/Liquid/Pipeline.pm ↑ Summary lib/WWW/Shopify/Liquid/Tag/Increment.pm »
1  
2 package WWW::Shopify::Liquid::Token;
3 29 ▶use base 'WWW::Shopify::Liquid::Element';
Subroutine BEGIN: called CC=1 SCAR=0.0
4 0 ▶sub new { return bless { line => $_[1], core => $_[2] }, $_[0]; };
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
5 0 ▶sub stringify { return $_[0]->{core}; }
Subroutine stringify: not called CC=1 SCAR=6.9
Pod undocumented
6 0 ▶sub tokens { return $_[0]; }
Subroutine tokens: not called CC=1 SCAR=6.9
Pod undocumented
7  
8 package WWW::Shopify::Liquid::Token::Operator;
9 29 ▶use base 'WWW::Shopify::Liquid::Token';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 package WWW::Shopify::Liquid::Token::Operand;
12 29 ▶use base 'WWW::Shopify::Liquid::Token';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 package WWW::Shopify::Liquid::Token::String;
15 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
16 0 ▶sub process { my ($self, $hash) = @_; return $self->{core}; }
Subroutine process: not called CC=1 SCAR=6.9
17  
18 package WWW::Shopify::Liquid::Token::Number;
19 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 0 ▶sub process { my ($self, $hash) = @_; return $self->{core}; }
Subroutine process: not called CC=1 SCAR=6.9
21  
22 package WWW::Shopify::Liquid::Token::NULL;
23 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
24 0 ▶sub process { return undef; }
Subroutine process: not called CC=1 SCAR=6.9
25  
26 # package WWW::Shopify::Liquid::Token::True;
27 # use base 'WWW::Shopify::Liquid::Token::Operand';
28 # sub process { return 1; }
29  
30 # package WWW::Shopify::Liquid::Token::False;
31 # use base 'WWW::Shopify::Liquid::Token::Operand';
32 # sub process { return 0; }
33  
34 # package WWW::Shopify::Liquid::Token::Blank;
35 # use base 'WWW::Shopify::Liquid::Token::Operand';
36 # sub process { return ''; }
37  
38 package WWW::Shopify::Liquid::Token::Bool;
39 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
40 0 ▶sub process { my ($self, $hash) = @_; return $self->{core}; }
Subroutine process: not called CC=1 SCAR=6.9
41  
42 package WWW::Shopify::Liquid::Token::FunctionCall;
43 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
44  
45 29 ▶use Scalar::Util qw(looks_like_number reftype blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
46  
47 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
48 0 my $package = shift;
49 0 return bless {
50 line => shift,
51 method => shift,
52 self => shift,
53 arguments => [@_]
54 }, $package;
55 }
56  
57 0 ▶sub process {
Subroutine process: not called CC=9 SCAR=45.0
58 0 my ($self, $hash, $action, $pipeline) = @_;
59 0 ▶ if ($action eq "render") {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "render") 0 0 0
60 0 ▶ die new WWW::Shopify::Liquid::Exception::Renderer::Forbidden($self->{line}) unless $pipeline->make_method_calls;
Branch: 1 branch
BranchTrueFalseTotal
unless $pipeline->make_method_calls 0 0 0
61
62 0 ▶ my @arguments = map { $self->is_processed($_) ? $_ : $_->render($pipeline, $hash) } @{$self->{arguments}};
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($_) ? : 0 0 0
63 0 ▶ my $inner_self = $self->is_processed($self->{self}) ? $self->{self} : $self->{self}->render($pipeline, $hash);
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($self->{'self'}) ? : 0 0 0
64 0 ▶ my $method = $self->is_processed($self->{method}) ? $self->{method} : $self->{method}->render($pipeline, $hash);
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($self->{'method'}) ? : 0 0 0
65 0 ▶ die new WWW::Shopify::Liquid::Exception::Renderer($self->{line}, "Can't find method $method on $inner_self.") unless $inner_self && blessed($inner_self) && !ref($method);
Branch: 1 branch
BranchTrueFalseTotal
unless $inner_self and builtin::blessed($inner_self) and not ref $method 0 0 0
Condition0%0/6
$inner_self and builtin::blessed($inner_self) and not ref $method
!ll&&!rl&&r
000
$inner_self and builtin::blessed($inner_self)
!ll&&!rl&&r
000
MC/DC0%0/3
$inner_self and builtin::blessed($inner_self) and not ref $method
$inner_self builtin::blessed($inner_self) not ref $method
Truth table0%0/4
A and B and not(C)
A= $inner_selfB= builtin::blessed($inner_self)C= not ref $method
ABCresult
0XX0
10X0
1100
1111
66 0 return $inner_self->$method(@arguments);
67 }
68 0 return $self;
69
70 }
71  
72 package WWW::Shopify::Liquid::Token::Variable;
73 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
74  
75 29 ▶use Scalar::Util qw(looks_like_number reftype blessed);
Subroutine BEGIN: called CC=1 SCAR=0.0
76  
77 0 ▶sub new { my $package = shift; return bless { line => shift, core => [@_] }, $package; };
Subroutine new: not called CC=1 SCAR=6.9
78 0 ▶sub process {
Subroutine process: not called CC=24 SCAR=64.0
79 0 my ($self, $hash, $action, $pipeline) = @_;
80 0 my $place = $hash;
81
82 0 my @inner = @{$self->{core}};
83 0 my $unprocessed = 0;
84 0 foreach my $part_idx (0..$#inner) {
85 0 my $part = $inner[$part_idx];
86 0 ▶ if (ref($part) eq 'WWW::Shopify::Liquid::Token::Variable::Processing') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $part eq 'WWW::Shopify::Liquid::Token::Variable::Processing') { } 0 0 0
87 0 $place = $part->$action($pipeline, $hash, $place);
88 }
89 else {
90 0 ▶ my $key = $self->is_processed($part) ? $part : $part->$action($pipeline, $hash);
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($part) ? : 0 0 0
91
92 0 ▶ return $self unless defined $key && $key ne '';
Branch: 1 branch
BranchTrueFalseTotal
unless defined $key and $key ne "" 0 0 0
Condition0%0/3
defined $key and $key ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
defined $key and $key ne ""
defined $key $key ne ""
Truth table0%0/3
A and B
A= defined $keyB= $key ne ""
ABresult
0X0
100
111
93 0 ▶ $self->{core}->[$part_idx] = $key if $self->is_processed($key) && $action eq "optimize";
Branch: 1 branch
BranchTrueFalseTotal
if $self->is_processed($key) and $action eq "optimize" 0 0 0
Condition0%0/3
$self->is_processed($key) and $action eq "optimize"
!ll&&!rl&&r
000
MC/DC0%0/2
$self->is_processed($key) and $action eq "optimize"
$self->is_processed($key) $action eq "optimize"
Truth table0%0/3
A and B
A= $self->is_processed($key)B= $action eq "optimize"
ABresult
0X0
100
111
94 0 ▶ if (defined $place) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $place) 0 0 0
95 0 ▶ if (blessed($place) && $place->isa('WWW::Shopify::Liquid::Resolver')) {
Branch: 4 branches
BranchTrueFalseTotal
if (builtin::blessed($place) and $place->isa('WWW::Shopify::Liquid::Resolver')) { } 0 0 0
elsif (builtin::reftype($place) and builtin::reftype($place) eq 'HASH' and exists $place->{$key}) { } 0 0 0
elsif (builtin::reftype($place) and builtin::reftype($place) eq 'ARRAY' and &looks_like_number($key) and defined $place->[$key]) { } 0 0 0
elsif ($pipeline->make_method_calls and builtin::blessed($place) and $place->can($key)) { } 0 0 0
Condition0%0/3
builtin::blessed($place) and $place->isa("WWW::Shopify::Liquid::Resolver")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($place) and $place->isa("WWW::Shopify::Liquid::Resolver")
builtin::blessed($place) $place->isa("WWW::Shopify::Liquid::Resolver")
Truth table0%0/3
A and B
A= builtin::blessed($place)B= $place->isa("WWW::Shopify::Liquid::Resolver")
ABresult
0X0
100
111
96 0 $place = $place->resolver->($place, $hash, $key);
97 ▶ } elsif (reftype($place) && reftype($place) eq "HASH" && exists $place->{$key}) {
Condition0%0/6
builtin::reftype($place) and builtin::reftype($place) eq "HASH" and exists $place->{$key}
!ll&&!rl&&r
000
builtin::reftype($place) and builtin::reftype($place) eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
builtin::reftype($place) and builtin::reftype($place) eq "HASH" and exists $place->{$key}
builtin::reftype($place) builtin::reftype($place) eq "HASH" exists $place->{$key}
Truth table0%0/4
A and B and C
A= builtin::reftype($place)B= builtin::reftype($place) eq "HASH"C= exists $place->{$key}
ABCresult
0XX0
10X0
1100
1111
98 0 $place = $place->{$key};
99 ▶ } elsif (reftype($place) && reftype($place) eq "ARRAY" && looks_like_number($key) && defined $place->[$key]) {
Condition0%0/9
builtin::reftype($place) and builtin::reftype($place) eq "ARRAY" and &looks_like_number($key) and defined $place->[$key]
!ll&&!rl&&r
000
builtin::reftype($place) and builtin::reftype($place) eq "ARRAY" and &looks_like_number($key)
!ll&&!rl&&r
000
builtin::reftype($place) and builtin::reftype($place) eq "ARRAY"
!ll&&!rl&&r
000
MC/DC0%0/4
builtin::reftype($place) and builtin::reftype($place) eq "ARRAY" and &looks_like_number($key) and defined $place->[$key]
builtin::reftype($place) builtin::reftype($place) eq "ARRAY" &looks_like_number($key) defined $place->[$key]
Truth table0%0/5
A and B and C and D
A= builtin::reftype($place)B= builtin::reftype($place) eq "ARRAY"C= &looks_like_number($key)D= defined $place->[$key]
ABCDresult
0XXX0
10XX0
110X0
11100
11111
100 0 $place = $place->[$key];
101 ▶ } elsif ($pipeline->make_method_calls && blessed($place) && $place->can($key)) {
Condition0%0/6
$pipeline->make_method_calls and builtin::blessed($place) and $place->can($key)
!ll&&!rl&&r
000
$pipeline->make_method_calls and builtin::blessed($place)
!ll&&!rl&&r
000
MC/DC0%0/3
$pipeline->make_method_calls and builtin::blessed($place) and $place->can($key)
$pipeline->make_method_calls builtin::blessed($place) $place->can($key)
Truth table0%0/4
A and B and C
A= $pipeline->make_method_callsB= builtin::blessed($place)C= $place->can($key)
ABCresult
0XX0
10X0
1100
1111
102 0 $place = $place->$key;
103 } else {
104 0 $unprocessed = 1;
105 0 $place = undef;
106 }
107 }
108
109 }
110 }
111 0 ▶ return $self if $unprocessed;
Branch: 1 branch
BranchTrueFalseTotal
if $unprocessed 0 0 0
112 0 ▶ return $place->resolver->($place, $hash) if (blessed($place) && $place->isa('WWW::Shopify::Liquid::Resolver'));
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($place) and $place->isa("WWW::Shopify::Liquid::Resolver") 0 0 0
Condition0%0/3
builtin::blessed($place) and $place->isa("WWW::Shopify::Liquid::Resolver")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($place) and $place->isa("WWW::Shopify::Liquid::Resolver")
builtin::blessed($place) $place->isa("WWW::Shopify::Liquid::Resolver")
Truth table0%0/3
A and B
A= builtin::blessed($place)B= $place->isa("WWW::Shopify::Liquid::Resolver")
ABresult
0X0
100
111
113 0 return $place;
114 }
115 0 ▶sub stringify { return join(".", map { $_->stringify } @{$_[0]->{core}}); }
Subroutine stringify: not called CC=1 SCAR=6.9
116  
117 0 ▶sub set {
Subroutine set: not called CC=2 SCAR=17.9
118 0 my ($self, $pipeline, $hash, $value) = @_;
119 0 ▶ my @vars = map { $self->is_processed($_) ? $_ : $_->render($pipeline, $hash) } @{$self->{core}};
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($_) ? : 0 0 0
120 0 my ($reference) = $pipeline->variable_reference($hash, \@vars);
121 0 $$reference = $value;
122 0 return 1;
123 }
124  
125  
126 0 ▶sub get {
Subroutine get: not called CC=3 SCAR=24.8
127 0 my ($self, $pipeline, $hash) = @_;
128 0 ▶ my @vars = map { $self->is_processed($_) ? $_ : $_->render($pipeline, $hash) } @{$self->{core}};
Branch: 1 branch
BranchTrueFalseTotal
$self->is_processed($_) ? : 0 0 0
129 0 my ($reference) = $pipeline->variable_reference($hash, \@vars, 1);
130 0 ▶ return $reference ? $$reference : undef;
Branch: 1 branch
BranchTrueFalseTotal
$reference ? : 0 0 0
131 }
132  
133 package WWW::Shopify::Liquid::Token::Variable::Processing;
134 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
135 0 ▶sub process {
Subroutine process: not called CC=3 SCAR=24.8
136 0 my ($self, $hash, $argument, $action, $pipeline) = @_;
137 0 ▶ return $self if !$self->is_processed($argument);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_processed($argument) 0 0 0
138 0 my $result = $self->{core}->operate($hash, $argument);
139 0 ▶ return $self if !$self->is_processed($result);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_processed($result) 0 0 0
140 0 return $result;
141 }
142  
143 package WWW::Shopify::Liquid::Token::Variable::Named;
144 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
145  
146 0 ▶sub new { my $package = shift; return bless { line => shift, name => shift, core => shift }, $package; };
Subroutine new: not called CC=1 SCAR=6.9
147 0 ▶sub process {
Subroutine process: not called CC=1 SCAR=6.9
148 0 my ($self, $hash, $action, $pipeline) = @_;
149 0 return { $self->{name} => $self->{core}->$action($pipeline, $hash) };
150 }
151  
152  
153 package WWW::Shopify::Liquid::Token::Grouping;
154 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
155 0 ▶sub new { my $package = shift; return bless { line => shift, members => [@_] }, $package; };
Subroutine new: not called CC=1 SCAR=6.9
156 0 ▶sub members { return @{$_[0]->{members}}; }
Subroutine members: not called CC=1 SCAR=6.9
157  
158 # Parentheses
159 package WWW::Shopify::Liquid::Token::Grouping::Parenthetical;
160 29 ▶use base 'WWW::Shopify::Liquid::Token::Grouping';
Subroutine BEGIN: called CC=1 SCAR=0.0
161  
162 # Like a grouping, but not really.
163 # Square brackets
164 package WWW::Shopify::Liquid::Token::Array;
165 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
166  
167 0 ▶sub new {
Subroutine new: not called CC=6 SCAR=37.4
168 0 my ($package, $line, @members) = @_;
169 # Check to see whether or not the incoming member array is separated by commas.
170 # Should never begin with a comma, should never end with a comma, should always be
171 # 101010101 in terms of data and separators. If this is not the case, then we
172 # Should throw a lexing exception.
173 die new WWW::Shopify::Liquid::Exception::Lexer::InvalidSeparator($line) unless
174 0 ▶ int(grep { ($_ % 2) == 0 && $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') } (0..$#members)) == 0 &&
Condition0%0/3
$_ % 2 == 0 && $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
!ll&&!rl&&r
000
MC/DC0%0/2
$_ % 2 == 0 && $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
$_ % 2 == 0 $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
Truth table0%0/3
A && B
A= $_ % 2 == 0B= $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
ABresult
0X0
100
111
175 0 ▶ int(grep { ($_ % 2) == 1 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]->{core} ne ",") } (0..$#members)) == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 2 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0 0 0 0
Condition0%0/9
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 2 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0
!ll&&!rl&&r
000
$_ % 2 == 1 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ',')
!ll&&!rl&&r
000
not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") or $members[$_]{"core"} ne ","
l!l&&r!l&&!r
000
MC/DC0%0/2
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 2 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 int grep({$_ % 2 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0
MC/DC0%0/3
$_ % 2 == 1 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ',')
$_ % 2 == 1 not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") $members[$_]{"core"} ne ","
Truth table0%0/3
A and B
A= int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0B= int grep({$_ % 2 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0
ABresult
0X0
100
111
Truth table0%0/4
A && not(B) or C
A= $_ % 2 == 1B= not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator")C= $members[$_]{"core"} ne ","
ABCresult
0XX0
1000
11X1
1011
176
177 my $self = bless {
178 line => $line,
179 0 members => [grep { !$_->isa('WWW::Shopify::Liquid::Token::Separator') } @members]
180 }, $package;
181 0 return $self;
182 };
183  
184 0 ▶sub members { return @{$_[0]->{members}}; }
Subroutine members: not called CC=1 SCAR=6.9
185 0 ▶sub process {
Subroutine process: not called CC=4 SCAR=30.0
186 0 my ($self, $hash, $action, $pipeline) = @_;
187 0 my @members = $self->members;
188 0 $members[$_] = $members[$_]->$action($pipeline, $hash) for (grep { !$self->is_processed($members[$_]) } (0..$#members));
189 0 ▶ if ($action eq "optimize") {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "optimize") 0 0 0
190 0 $self->{members}->[$_] = $_ for (grep { $self->is_processed($members[$_]) } 0..$#members);
191 }
192 0 return [@members];
193 }
194  
195 # Curly brackets
196 package WWW::Shopify::Liquid::Token::Hash;
197 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
198  
199 0 ▶sub members { return @{$_[0]->{members}}; }
Subroutine members: not called CC=1 SCAR=6.9
200 0 ▶sub new {
Subroutine new: not called CC=11 SCAR=48.8
201 0 my ($package, $line, @members) = @_;
202
203 0 @members = map { $_->isa('WWW::Shopify::Liquid::Token::Variable::Named') ? (
204 WWW::Shopify::Liquid::Token::String->new($_->{line}, $_->{name}),
205 WWW::Shopify::Liquid::Token::Separator->new($_->{line}, ':'),
206 $_->{core}
207 0 ▶ ) : $_ } @members;
Branch: 1 branch
BranchTrueFalseTotal
$_->isa('WWW::Shopify::Liquid::Token::Variable::Named') ? : 0 0 0
208
209 die new WWW::Shopify::Liquid::Exception::Lexer::InvalidSeparator($line) unless
210 0 ▶ int(grep { ($_ % 2) == 0 && $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') } (0..$#members)) == 0 &&
Condition0%0/3
$_ % 2 == 0 && $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
!ll&&!rl&&r
000
MC/DC0%0/2
$_ % 2 == 0 && $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
$_ % 2 == 0 $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
Truth table0%0/3
A && B
A= $_ % 2 == 0B= $members[$_]->isa('WWW::Shopify::Liquid::Token::Separator')
ABresult
0X0
100
111
211 int(grep {
212 ($_ % 4) == 1 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]->{core} ne ":") ||
213 0 ▶ ($_ % 4) == 3 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]->{core} ne ",")
Condition0%0/15
$_ % 4 == 1 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ':') || $_ % 4 == 3 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ',')
l!l&&r!l&&!r
000
$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":"
!ll&&!rl&&r
000
not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") or $members[$_]{"core"} ne ":"
l!l&&r!l&&!r
000
$_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ","
!ll&&!rl&&r
000
not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") or $members[$_]{"core"} ne ","
l!l&&r!l&&!r
000
MC/DC0%0/6
$_ % 4 == 1 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ':') || $_ % 4 == 3 && (!$members[$_]->isa('WWW::Shopify::Liquid::Token::Separator') || $members[$_]{'core'} ne ',')
$_ % 4 == 1 not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") $members[$_]{"core"} ne ":" $_ % 4 == 3 not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") $members[$_]{"core"} ne ","
Truth table0%0/10
A and not(B) or C || D and not(E) or F
A= $_ % 4 == 1B= not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator")C= $members[$_]{"core"} ne ":"D= $_ % 4 == 3E= not $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator")F= $members[$_]{"core"} ne ","
ABCDEFresult
11XXXX1
101XXX1
0XX11X1
0XX1011
10011X1
1001011
0XX0XX0
0XX1000
1000XX0
1001000
214 } (0..$#members)) == 0 &&
215 0 ▶ int(grep { !$_->isa('WWW::Shopify::Liquid::Token::Separator') } @members) % 2 == 0;
Branch: 1 branch
BranchTrueFalseTotal
unless int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":" or $_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0 and int(grep {not $_->isa("WWW::Shopify::Liquid::Token::Separator");} @members) % 2 == 0 0 0 0
Condition0%0/6
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":" or $_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0 and int(grep {not $_->isa("WWW::Shopify::Liquid::Token::Separator");} @members) % 2 == 0
!ll&&!rl&&r
000
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":" or $_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0
!ll&&!rl&&r
000
MC/DC0%0/3
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 and int grep({$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":" or $_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0 and int(grep {not $_->isa("WWW::Shopify::Liquid::Token::Separator");} @members) % 2 == 0
int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0 int grep({$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":" or $_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0 int(grep {not $_->isa("WWW::Shopify::Liquid::Token::Separator");} @members) % 2 == 0
Truth table0%0/4
A and B and C
A= int grep({$_ % 2 == 0 and $members[$_]->isa("WWW::Shopify::Liquid::Token::Separator");} 0 .. $#members) == 0B= int grep({$_ % 4 == 1 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ":" or $_ % 4 == 3 and !$members[$_]->isa("WWW::Shopify::Liquid::Token::Separator") || $members[$_]{"core"} ne ",";} 0 .. $#members) == 0C= int(grep {not $_->isa("WWW::Shopify::Liquid::Token::Separator");} @members) % 2 == 0
ABCresult
0XX0
10X0
1100
1111
216
217 return bless {
218 line => $line,
219 0 members => [grep { !$_->isa('WWW::Shopify::Liquid::Token::Separator') } @members]
220 }, $package;
221 };
222  
223 0 ▶sub process {
Subroutine process: not called CC=4 SCAR=30.0
224 0 my ($self, $hash, $action, $pipeline) = @_;
225 0 my @members = $self->members;
226 0 $members[$_] = $members[$_]->$action($pipeline, $hash) for (grep { !$self->is_processed($members[$_]) } (0..$#members));
227 0 ▶ if ($action eq "optimize") {
Branch: 1 branch
BranchTrueFalseTotal
if ($action eq "optimize") 0 0 0
228 0 $self->{members}->[$_] = $_ for (grep { $self->is_processed($members[$_]) } 0..$#members);
229 }
230 0 return { @members };
231 }
232  
233  
234 package WWW::Shopify::Liquid::Token::Text;
235 29 ▶use base 'WWW::Shopify::Liquid::Token::Operand';
Subroutine BEGIN: called CC=1 SCAR=0.0
236 0 ▶sub new {
Subroutine new: not called CC=3 SCAR=24.8
237 0 my $self = { line => $_[1], core => $_[2] };
238 0 my $package = $_[0];
239 0 ▶ $package = 'WWW::Shopify::Liquid::Token::Text::Whitespace' if !defined $_[2] || $_[2] =~ m/^\s*$/;
Branch: 1 branch
BranchTrueFalseTotal
if not defined $_[2] or $_[2] =~ /^\s*$/ 0 0 0
Condition0%0/3
not defined $_[2] or $_[2] =~ /^\s*$/
l!l&&r!l&&!r
000
MC/DC0%0/2
not defined $_[2] or $_[2] =~ /^\s*$/
not defined $_[2] $_[2] =~ /^\s*$/
Truth table0%0/3
not(A) or B
A= not defined $_[2]B= $_[2] =~ /^\s*$/
ABresult
1X1
011
000
240 0 return bless $self, $package;
241 };
242 0 ▶sub process { my ($self, $hash) = @_; return $self->{core}; }
Subroutine process: not called CC=1 SCAR=6.9
243  
244 package WWW::Shopify::Liquid::Token::Text::Whitespace;
245 29 ▶use base 'WWW::Shopify::Liquid::Token::Text';
Subroutine BEGIN: called CC=1 SCAR=0.0
246  
247 package WWW::Shopify::Liquid::Token::Tag;
248 29 ▶use base 'WWW::Shopify::Liquid::Token';
Subroutine BEGIN: called CC=1 SCAR=0.0
249 0 ▶sub new { return bless { line => $_[1], tag => $_[2], arguments => $_[3], strip_left => $_[4], strip_right => $_[5] }, $_[0] };
Subroutine new: not called CC=1 SCAR=6.9
250 0 ▶sub tag { return $_[0]->{tag}; }
Subroutine tag: not called CC=1 SCAR=6.9
251 0 ▶sub stringify { return $_[0]->tag; }
Subroutine stringify: not called CC=1 SCAR=6.9
252  
253 package WWW::Shopify::Liquid::Token::Output;
254 29 ▶use base 'WWW::Shopify::Liquid::Token';
Subroutine BEGIN: called CC=1 SCAR=0.0
255 0 ▶sub new { return bless { line => $_[1], core => $_[2], strip_left => $_[3], strip_right => $_[4] }, $_[0]; };
Subroutine new: not called CC=1 SCAR=6.9
256  
257 package WWW::Shopify::Liquid::Token::Separator;
258 29 ▶use base 'WWW::Shopify::Liquid::Token';
Subroutine BEGIN: called CC=1 SCAR=0.0
259  
260  
261 29 1;
« lib/WWW/Shopify/Liquid/Pipeline.pm ↑ Summary lib/WWW/Shopify/Liquid/Tag/Increment.pm »