lib/WWW/Shopify/Liquid/Filter/Pluck.pm

filter: Statementstmt 52.6% 10 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 3 totaltotal 28.2% 13 / 46 CC 6 SCAR 31.6
CC
6
Cov
31%
operate
42.0
min_arguments
2.0
max_arguments
2.0
CRAP 23.5
« lib/WWW/Shopify/Liquid/Tag/CreateFilter.pm ↑ Summary lib/WWW/Shopify/Liquid/Operator/NotRegex.pm »
1 #!/usr/bin/perl
2 38 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 38 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 38 ▶package WWW::Shopify::Liquid::Filter::Pluck; use base 'WWW::Shopify::Liquid::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
6 0 ▶sub min_arguments { 3; }
Subroutine min_arguments: not called CC=1 SCAR=6.9
Pod undocumented
7 0 ▶sub max_arguments { 3; }
Subroutine max_arguments: not called CC=1 SCAR=6.9
Pod undocumented
8 0 ▶sub operate {
Subroutine operate: not called CC=6 SCAR=37.4
Pod undocumented
9 0 my ($self, $hash, $operand, @arguments) = @_;
10 0 my ($field, $value, $wantedfield) = @arguments;
11
12 0 ▶ return undef unless ref($operand) eq "ARRAY";
Branch: 1 branch
BranchTrueFalseTotal
unless ref $operand eq "ARRAY" 0 0 0
13 0 ▶ my @items = grep { ref($_) eq "HASH" && defined $_->{$field} && $_->{$field} eq $value } @$operand;
Condition0%0/6
ref $_ eq 'HASH' && defined $_->{$field} && $_->{$field} eq $value
!ll&&!rl&&r
000
ref $_ eq "HASH" and defined $_->{$field}
!ll&&!rl&&r
000
MC/DC0%0/3
ref $_ eq 'HASH' && defined $_->{$field} && $_->{$field} eq $value
ref $_ eq "HASH" defined $_->{$field} $_->{$field} eq $value
Truth table0%0/4
A and B && C
A= ref $_ eq "HASH"B= defined $_->{$field}C= $_->{$field} eq $value
ABCresult
0XX0
10X0
1100
1111
14 0 ▶ return undef unless int(@items) > 0 && ref($items[0]) eq "HASH";
Branch: 1 branch
BranchTrueFalseTotal
unless int @items > 0 and ref $items[0] eq "HASH" 0 0 0
Condition0%0/3
int @items > 0 and ref $items[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
int @items > 0 and ref $items[0] eq "HASH"
int @items > 0 ref $items[0] eq "HASH"
Truth table0%0/3
A and B
A= int @items > 0B= ref $items[0] eq "HASH"
ABresult
0X0
100
111
15 0 return $items[0]->{$wantedfield};
16
17 }
18  
19 38 1;
« lib/WWW/Shopify/Liquid/Tag/CreateFilter.pm ↑ Summary lib/WWW/Shopify/Liquid/Operator/NotRegex.pm »