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

filter: Statementstmt 26.5% 13 / 49 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 7 Subroutinesub 22.2% 4 / 18 Podpod 0.0% 0 / 9 totaltotal 15.1% 17 / 112 CC 13 SCAR 29.1
CC
13
Cov
17%
process
42.0
optimize
42.0
abstract
6.0
CRAP 18.4
« blib/lib/WWW/Shopify/Liquid/Operator/NotRegex.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Filter/First.pm »
1 #!/usr/bin/perl
2  
3 30 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 30 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package WWW::Shopify::Liquid::Tag;
7 30 ▶use base 'WWW::Shopify::Liquid::Element';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub inner_tags { return (); }
Subroutine inner_tags: not called CC=1 SCAR=6.9
Pod undocumented
10 0 ▶sub abstract { my $package = ref($_[0]) ? ref($_[0]) : $_[0]; return ($package eq __PACKAGE__); }
Subroutine abstract: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
11 0 ▶sub name { my $package = ref($_[0]) ? ref($_[0]) : $_[0]; $package =~ s/^.*:://; $package =~ s/([a-z])([A-Z])/$1_$2/g; return lc($package); }
Subroutine name: not called CC=2 SCAR=17.9
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
ref $_[0] ? : 0 0 0
12 sub new {
13 0 ▶ my ($package, $line, $tag, $arguments, $contents) = @_;
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
14 0 my $self = { line => $line, core => $tag, arguments => $arguments, contents => $contents };
15 0 return bless $self, $package;
16 }
17 0 ▶sub is_free { return 0; }
Subroutine is_free: not called CC=1 SCAR=6.9
Pod undocumented
18 0 ▶sub is_enclosing { return 0; }
Subroutine is_enclosing: not called CC=1 SCAR=6.9
Pod undocumented
19 0 ▶sub min_arguments { return 0; }
Subroutine min_arguments: not called CC=1 SCAR=6.9
Pod undocumented
20 0 ▶sub max_arguments { return undef; }
Subroutine max_arguments: not called CC=1 SCAR=6.9
Pod undocumented
21  
22 0 ▶sub tokens { return ($_[0], map { $_->tokens } grep { defined $_ } (@{$_[0]->{arguments}}, $_[0]->{contents})) }
Subroutine tokens: not called CC=1 SCAR=6.9
Pod undocumented
23  
24 package WWW::Shopify::Liquid::Tag::Output;
25 30 ▶use base 'WWW::Shopify::Liquid::Tag::Free';
Subroutine BEGIN: called CC=1 SCAR=0.0
26  
27 0 ▶sub max_arguments { return 1; }
Subroutine max_arguments: not called CC=1 SCAR=6.9
28 0 ▶sub abstract { return 0; }
Subroutine abstract: not called CC=1 SCAR=6.9
29  
30 sub new {
31 0 ▶ my ($package, $line, $arguments) = @_;
Subroutine new: not called CC=1 SCAR=6.9
32 0 my $self = { arguments => $arguments, line => $line };
33 0 return bless $self, $package;
34 }
35 sub process {
36 0 ▶ my ($self, $hash, $action, $pipeline) = @_;
Subroutine process: not called CC=6 SCAR=37.4
37 0 ▶ return '' unless int(@{$self->{arguments}}) > 0;
Branch: 1 branch
BranchTrueFalseTotal
unless int @{$self->{"arguments"};} > 0 0 0 0
38 0 my $result = $self->{arguments}->[0]->$action($pipeline, $hash);
39 0 ▶ return '' if !defined $result && ref($result) && (ref($result) eq "ARRAY" || ref($result) eq "HASH");
Branch: 1 branch
BranchTrueFalseTotal
if not defined $result and ref $result and ref $result eq "ARRAY" || ref $result eq "HASH" 0 0 0
Condition0%0/9
not defined $result and ref $result and ref $result eq "ARRAY" || ref $result eq "HASH"
!ll&&!rl&&r
000
not defined $result and ref $result
!ll&&!rl&&r
000
ref $result eq "ARRAY" or ref $result eq "HASH"
l!l&&r!l&&!r
000
MC/DC0%0/4
not defined $result and ref $result and ref $result eq "ARRAY" || ref $result eq "HASH"
not defined $result ref $result ref $result eq "ARRAY" ref $result eq "HASH"
Truth table0%0/5
not(A) and B and C or D
A= not defined $resultB= ref $resultC= ref $result eq "ARRAY"D= ref $result eq "HASH"
ABCDresult
0XXX0
10XX0
11000
111X1
11011
40 0 return $result;
41 }
42  
43 sub optimize {
44 0 ▶ my ($self, $optimizer, $hash) = @_;
Subroutine optimize: not called CC=6 SCAR=37.4
45 0 ▶ $self->{arguments}->[0] = $self->{arguments}->[0]->optimize($optimizer, $hash) if !$self->is_processed($self->{arguments}->[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless $self->is_processed($self->{"arguments"}[0]) 0 0 0
46
47 0 ▶ if ($self->is_processed($self->{arguments}->[0])) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->is_processed($self->{"arguments"}[0])) 0 0 0
48 0 my $result = $self->{arguments}->[0];
49 0 ▶ return '' if ref($result) && (ref($result) eq "ARRAY" || ref($result) eq "HASH");
Branch: 1 branch
BranchTrueFalseTotal
if ref $result and ref $result eq "ARRAY" || ref $result eq "HASH" 0 0 0
Condition0%0/6
ref $result and ref $result eq "ARRAY" || ref $result eq "HASH"
!ll&&!rl&&r
000
ref $result eq "ARRAY" or ref $result eq "HASH"
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $result and ref $result eq "ARRAY" || ref $result eq "HASH"
ref $result ref $result eq "ARRAY" ref $result eq "HASH"
Truth table0%0/4
A and B or C
A= ref $resultB= ref $result eq "ARRAY"C= ref $result eq "HASH"
ABCresult
0XX0
1000
11X1
1011
50 0 return $result;
51 }
52 0 return $self;
53 }
54  
55 30 1;
« blib/lib/WWW/Shopify/Liquid/Operator/NotRegex.pm ↑ Summary blib/lib/WWW/Shopify/Liquid/Filter/First.pm »