« lib/WWW/Shopify/Liquid/Dialect/Shopify/Filter/MoneyWithoutTrailingZeros.pm
↑ Summary
lib/WWW/Shopify/Liquid/Filter/Join.pm »
| 1 | #!/usr/bin/perl | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 38 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 38 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 38 | ▶ | use WWW::Shopify::Liquid; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 37 | ▶ | use WWW::Shopify::Liquid::Element; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||||||||||||
| 9 | package WWW::Shopify::Liquid::Filter; | ||||||||||||||||||||||||||||||||||||||||||
| 10 | 37 | ▶ | use base 'WWW::Shopify::Liquid::Element'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 0 | ▶ | sub subelements { qw(operand arguments) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subelements: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 0 | ▶ | sub new { my $package = shift; my $parser = shift; return bless { line => shift, core => shift, operand => shift, arguments => [@_] }, $package; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | # Determines whether or not this acts as a variable with no arguments, when used in conjucntion to a dot on a variable. | ||||||||||||||||||||||||||||||||||||||||||
| 15 | 0 | ▶ | sub transparent { return 0; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transparent: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 16 | 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
| |||||||||||||||||||||||||||||||||||||||||||
| 17 | 0 | ▶ | sub min_arguments { return 0; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
min_arguments: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 18 | 0 | ▶ | sub max_arguments { return undef; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
max_arguments: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 0 | ▶ | sub verify { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
verify: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 21 | 0 | my $count = int(@{$self->{arguments}}); | |||||||||||||||||||||||||||||||||||||||||
| 22 | 0 | ▶ | die new WWW::Shopify::Liquid::Exception::Parser::Arguments($self, [$count, $self->min_arguments, $self->max_arguments]) if | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
$count < $self->min_arguments or defined $self->max_arguments and $count > $self->max_arguments
defined $self->max_arguments and $count > $self->max_arguments
MC/DC0%0/3
$count < $self->min_arguments or defined $self->max_arguments and $count > $self->max_arguments
$count < $self->min_arguments
defined $self->max_arguments
$count > $self->max_arguments
Truth table0%0/4
A or B and C
A= $count < $self->min_argumentsB= defined $self->max_argumentsC= $count > $self->max_arguments
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | $count < $self->min_arguments || (defined $self->max_arguments && $count > $self->max_arguments); | ||||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub tokens { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
tokens: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 27 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 28 | 0 | ▶ | return ($self, map { $self->is_processed($_) ? $_ : $_->tokens } (@{$_[0]->{arguments}}, $_[0]->{operand})); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub process { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
process: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 0 | my ($self, $hash, $action, $pipeline) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my ($operand, $arguments) = $self->process_subelements($hash, $action, $pipeline); | |||||||||||||||||||||||||||||||||||||||||
| 34 | 0 | ▶ | return $self unless $self->is_processed($operand) && int(grep { !$self->is_processed($_) } @$arguments) == 0; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->is_processed($operand) and int grep({not $self->is_processed($_);} @$arguments) == 0
MC/DC0%0/2
$self->is_processed($operand) and int grep({not $self->is_processed($_);} @$arguments) == 0
$self->is_processed($operand)
int grep({not $self->is_processed($_);} @$arguments) == 0
Truth table0%0/3
A and B
A= $self->is_processed($operand)B= int grep({not $self->is_processed($_);} @$arguments) == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | return $self->operate($hash, $operand, @$arguments); | |||||||||||||||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||||||||||||
| 38 | 0 | ▶ | sub stringify { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
stringify: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | return $_[0]->{core}; | |||||||||||||||||||||||||||||||||||||||||
| 40 | } | ||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||
| 42 | package WWW::Shopify::Liquid::Filter::Unknown; | ||||||||||||||||||||||||||||||||||||||||||
| 43 | 37 | ▶ | use base 'WWW::Shopify::Liquid::Filter'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | # Don't optimize anything on unknown filters. | ||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | sub optimize { return $_[0]; } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
optimize: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||
| 48 | 37 | 1; | |||||||||||||||||||||||||||||||||||||||||