Shopify/Field/Relation.pm

filter: Statementstmt 43.1% 25 / 58 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 72 MC/DCmcdc 0.0% 0 / 32 Subroutinesub 19.5% 8 / 41 Podpod 0.0% 0 / 16 totaltotal 14.5% 33 / 227 CC 29 SCAR 30.7
CC
29
Cov
18%
is_db_has_many
90.0
is_db_belongs_to
42.0
is_db_many_many
30.0
CRAP 21.6
« Shopify/Multiplexer.pm ↑ Summary Shopify/Field/String.pm »
1 #!/usr/bin/perl
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 package WWW::Shopify::Field::Relation;
7 1 ▶use parent 'WWW::Shopify::Field';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 0 ▶sub new {
Subroutine new: not called CC=1 SCAR=6.9
Pod undocumented
9 0 my $package = shift;
10 0 my $calling_package = caller(0);
11 0 return bless {
12 arguments => [@_],
13 name => undef,
14 owner => $calling_package,
15 relation => $_[0]
16 }, $package;
17 }
18 0 ▶sub relation { return $_[0]->{relation}; }
Subroutine relation: not called CC=1 SCAR=6.9
Pod undocumented
19 0 ▶sub is_relation { return 1; }
Subroutine is_relation: not called CC=1 SCAR=6.9
Pod undocumented
20 0 ▶sub is_many { return undef; }
Subroutine is_many: not called CC=1 SCAR=6.9
Pod undocumented
21 0 ▶sub is_one { return undef; }
Subroutine is_one: not called CC=1 SCAR=6.9
Pod undocumented
22 0 ▶sub is_own { return undef; }
Subroutine is_own: not called CC=1 SCAR=6.9
Pod undocumented
23 0 ▶sub is_reference { return undef; }
Subroutine is_reference: not called CC=1 SCAR=6.9
Pod undocumented
24 0 ▶sub is_parent { return undef; }
Subroutine is_parent: not called CC=1 SCAR=6.9
Pod undocumented
25 0 ▶sub sql_type { return WWW::Shopify::Field::Identifier->sql_type(); }
Subroutine sql_type: not called CC=1 SCAR=6.9
Pod undocumented
26  
27 0 ▶sub is_db_belongs_to { return ($_[0]->is_reference && $_[0]->is_one) || ($_[0]->is_one && $_[0]->is_own && (!$_[0]->relation->parent || $_[0]->relation->parent ne $_[0]->owner )); }
Subroutine is_db_belongs_to: not called CC=6 SCAR=37.4
Pod undocumented
Condition0%0/15
$_[0]->is_reference && $_[0]->is_one || $_[0]->is_one && $_[0]->is_own && (!$_[0]->relation->parent || $_[0]->relation->parent ne $_[0]->owner)
l!l&&r!l&&!r
000
$_[0]->is_reference and $_[0]->is_one
!ll&&!rl&&r
000
$_[0]->is_one and $_[0]->is_own and !$_[0]->relation->parent || $_[0]->relation->parent ne $_[0]->owner
!ll&&!rl&&r
000
$_[0]->is_one and $_[0]->is_own
!ll&&!rl&&r
000
not $_[0]->relation->parent or $_[0]->relation->parent ne $_[0]->owner
l!l&&r!l&&!r
000
MC/DC0%0/6
$_[0]->is_reference && $_[0]->is_one || $_[0]->is_one && $_[0]->is_own && (!$_[0]->relation->parent || $_[0]->relation->parent ne $_[0]->owner)
$_[0]->is_reference $_[0]->is_one $_[0]->is_one $_[0]->is_own not $_[0]->relation->parent $_[0]->relation->parent ne $_[0]->owner
Truth table0%0/11
A and B || C and D and not(E) or F
A= $_[0]->is_referenceB= $_[0]->is_oneC= $_[0]->is_oneD= $_[0]->is_ownE= not $_[0]->relation->parentF= $_[0]->relation->parent ne $_[0]->owner
ABCDEFresult
11XXXX1
0X111X1
0X11011
10111X1
1011011
0X0XXX0
0X10XX0
0X11000
100XXX0
1010XX0
1011000
28 0 ▶sub is_db_has_one { return $_[0]->is_one && $_[0]->is_own && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner}
Subroutine is_db_has_one: not called CC=4 SCAR=30.0
Pod undocumented
Condition0%0/9
$_[0]->is_one && $_[0]->is_own && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner
!ll&&!rl&&r
000
$_[0]->is_one and $_[0]->is_own and $_[0]->relation->parent
!ll&&!rl&&r
000
$_[0]->is_one and $_[0]->is_own
!ll&&!rl&&r
000
MC/DC0%0/4
$_[0]->is_one && $_[0]->is_own && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner
$_[0]->is_one $_[0]->is_own $_[0]->relation->parent $_[0]->relation->parent eq $_[0]->owner
Truth table0%0/5
A and B and C && D
A= $_[0]->is_oneB= $_[0]->is_ownC= $_[0]->relation->parentD= $_[0]->relation->parent eq $_[0]->owner
ABCDresult
0XXX0
10XX0
110X0
11100
11111
29 0 ▶sub is_db_has_many {
Subroutine is_db_has_many: not called CC=9 SCAR=45.0
Pod undocumented
30 return !$_[0]->is_db_belongs_to && !$_[0]->is_db_has_one && $_[0]->is_many && (
31 ($_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner) ||
32 ($_[0]->{arguments}->[1] && ref($_[0]->{arguments}->[1]) && ref($_[0]->{arguments}->[1]) eq 'HASH' && $_[0]->{arguments}->[1]->{direct})
33 0 ▶ ); }
Condition0%0/24
!($_[0]->is_db_belongs_to || $_[0]->is_db_has_one) && $_[0]->is_many && ($_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner || $_[0]{'arguments'}[1] && ref $_[0]{'arguments'}[1] && ref $_[0]{'arguments'}[1] eq 'HASH' && $_[0]{'arguments'}[1]{'direct'})
!ll&&!rl&&r
000
not $_[0]->is_db_belongs_to || $_[0]->is_db_has_one and $_[0]->is_many
!ll&&!rl&&r
000
$_[0]->is_db_belongs_to || $_[0]->is_db_has_one
l!l&&r!l&&!r
000
$_[0]->relation->parent and $_[0]->relation->parent eq $_[0]->owner or $_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1] eq "HASH" and $_[0]{"arguments"}[1]{"direct"}
l!l&&r!l&&!r
000
$_[0]->relation->parent and $_[0]->relation->parent eq $_[0]->owner
!ll&&!rl&&r
000
$_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1] eq "HASH" and $_[0]{"arguments"}[1]{"direct"}
!ll&&!rl&&r
000
$_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1] eq "HASH"
!ll&&!rl&&r
000
$_[0]{"arguments"}[1] and ref $_[0]{"arguments"}[1]
!ll&&!rl&&r
000
MC/DC0%0/9
!($_[0]->is_db_belongs_to || $_[0]->is_db_has_one) && $_[0]->is_many && ($_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner || $_[0]{'arguments'}[1] && ref $_[0]{'arguments'}[1] && ref $_[0]{'arguments'}[1] eq 'HASH' && $_[0]{'arguments'}[1]{'direct'})
$_[0]->is_db_belongs_to $_[0]->is_db_has_one $_[0]->is_many $_[0]->relation->parent $_[0]->relation->parent eq $_[0]->owner $_[0]{"arguments"}[1] ref $_[0]{"arguments"}[1] ref $_[0]{"arguments"}[1] eq "HASH" $_[0]{"arguments"}[1]{"direct"}
Truth table0%0/14
not(A || B) and C && D and E or F and G and H and I
A= $_[0]->is_db_belongs_toB= $_[0]->is_db_has_oneC= $_[0]->is_manyD= $_[0]->relation->parentE= $_[0]->relation->parent eq $_[0]->ownerF= $_[0]{"arguments"}[1]G= ref $_[0]{"arguments"}[1]H= ref $_[0]{"arguments"}[1] eq "HASH"I= $_[0]{"arguments"}[1]{"direct"}
ABCDEFGHIresult
1XXXXXXXX0
01XXXXXXX0
000XXXXXX0
0010X0XXX0
0010X10XX0
0010X110X0
0010X11100
001100XXX0
0011010XX0
00110110X0
0011011100
00111XXXX1
0010X11111
0011011111
34 0 ▶sub is_db_many_many { return !$_[0]->is_db_belongs_to && !$_[0]->is_db_has_one && !$_[0]->is_db_has_many && ($_[0]->is_many || $_[0]->is_own); }
Subroutine is_db_many_many: not called CC=5 SCAR=34.0
Pod undocumented
Condition0%0/12
!($_[0]->is_db_belongs_to || $_[0]->is_db_has_one || $_[0]->is_db_has_many) && ($_[0]->is_many || $_[0]->is_own)
!ll&&!rl&&r
000
$_[0]->is_db_belongs_to || $_[0]->is_db_has_one || $_[0]->is_db_has_many
l!l&&r!l&&!r
000
$_[0]->is_db_belongs_to or $_[0]->is_db_has_one
l!l&&r!l&&!r
000
$_[0]->is_many or $_[0]->is_own
l!l&&r!l&&!r
000
MC/DC0%0/5
!($_[0]->is_db_belongs_to || $_[0]->is_db_has_one || $_[0]->is_db_has_many) && ($_[0]->is_many || $_[0]->is_own)
$_[0]->is_db_belongs_to $_[0]->is_db_has_one $_[0]->is_db_has_many $_[0]->is_many $_[0]->is_own
Truth table0%0/6
not(A or B || C) && D or E
A= $_[0]->is_db_belongs_toB= $_[0]->is_db_has_oneC= $_[0]->is_db_has_manyD= $_[0]->is_manyE= $_[0]->is_own
ABCDEresult
1XXXX0
01XXX0
001XX0
000000
0001X1
000011
35 0 ▶sub db_min_count { }
Subroutine db_min_count: not called CC=1 SCAR=0.0
Pod undocumented
36 0 ▶sub db_max_count { }
Subroutine db_max_count: not called CC=1 SCAR=0.0
Pod undocumented
37 1 ▶use Math::Round qw(round);
Subroutine BEGIN: called CC=1 SCAR=0.0
38 0 ▶sub db_rand_count { return $_[0]->db_min_count + round(rand($_[0]->db_max_count - $_[0]->db_min_count)); }
Subroutine db_rand_count: not called CC=1 SCAR=6.9
Pod undocumented
39  
40 package WWW::Shopify::Field::Relation::Parent;
41 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
42 0 ▶sub is_parent { return 1; }
Subroutine is_parent: not called CC=1 SCAR=6.9
43 0 ▶sub is_reference { return 1; }
Subroutine is_reference: not called CC=1 SCAR=6.9
44 0 ▶sub is_one { return 1; }
Subroutine is_one: not called CC=1 SCAR=6.9
45  
46 0 ▶sub db_min_count { return 1; }
Subroutine db_min_count: not called CC=1 SCAR=6.9
47 0 ▶sub db_max_count { return 1; }
Subroutine db_max_count: not called CC=1 SCAR=6.9
48  
49 package WWW::Shopify::Field::Relation::Many;
50 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
51 0 ▶sub is_many { return 1; }
Subroutine is_many: not called CC=1 SCAR=6.9
52  
53 0 ▶sub db_min_count { return defined $_[0]->{arguments}->[1] && !ref($_[0]->{arguments}->[1]) ? $_[0]->{arguments}->[1] : 0; }
Subroutine db_min_count: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[1] && !ref($_[0]{'arguments'}[1]) ? : 0 0 0
Condition0%0/3
defined $_[0]{"arguments"}[1] and not ref $_[0]{"arguments"}[1]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0]{"arguments"}[1] and not ref $_[0]{"arguments"}[1]
defined $_[0]{"arguments"}[1] not ref $_[0]{"arguments"}[1]
Truth table0%0/3
A and not(B)
A= defined $_[0]{"arguments"}[1]B= not ref $_[0]{"arguments"}[1]
ABresult
0X0
100
111
54 0 ▶sub db_max_count { return defined $_[0]->{arguments}->[2] && !ref($_[0]->{arguments}->[2]) ? $_[0]->{arguments}->[2] : 5; }
Subroutine db_max_count: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[2] && !ref($_[0]{'arguments'}[2]) ? : 0 0 0
Condition0%0/3
defined $_[0]{"arguments"}[2] and not ref $_[0]{"arguments"}[2]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0]{"arguments"}[2] and not ref $_[0]{"arguments"}[2]
defined $_[0]{"arguments"}[2] not ref $_[0]{"arguments"}[2]
Truth table0%0/3
A and not(B)
A= defined $_[0]{"arguments"}[2]B= not ref $_[0]{"arguments"}[2]
ABresult
0X0
100
111
55  
56 package WWW::Shopify::Field::Relation::ReferenceOne;
57 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
58 0 ▶sub is_one { return 1; }
Subroutine is_one: not called CC=1 SCAR=6.9
59 0 ▶sub is_reference { return 1; }
Subroutine is_reference: not called CC=1 SCAR=6.9
60 0 ▶sub data_type { return WWW::Shopify::Field->TYPE_QUANTITATIVE; }
Subroutine data_type: not called CC=1 SCAR=6.9
61  
62 0 ▶sub db_min_count { return defined $_[0]->{arguments}->[1] && !ref($_[0]->{arguments}->[1]) ? $_[0]->{arguments}->[1] : 0; }
Subroutine db_min_count: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[1] && !ref($_[0]{'arguments'}[1]) ? : 0 0 0
Condition0%0/3
defined $_[0]{"arguments"}[1] and not ref $_[0]{"arguments"}[1]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0]{"arguments"}[1] and not ref $_[0]{"arguments"}[1]
defined $_[0]{"arguments"}[1] not ref $_[0]{"arguments"}[1]
Truth table0%0/3
A and not(B)
A= defined $_[0]{"arguments"}[1]B= not ref $_[0]{"arguments"}[1]
ABresult
0X0
100
111
63 0 ▶sub db_max_count { return 1; }
Subroutine db_max_count: not called CC=1 SCAR=6.9
64  
65 package WWW::Shopify::Field::Relation::OwnOne;
66 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
67 0 ▶sub is_one { return 1; }
Subroutine is_one: not called CC=1 SCAR=6.9
68 0 ▶sub is_own { return 1; }
Subroutine is_own: not called CC=1 SCAR=6.9
69  
70 0 ▶sub db_min_count { return defined $_[0]->{arguments}->[1] && !ref($_[0]->{arguments}->[1]) ? $_[0]->{arguments}->[1] : 0; }
Subroutine db_min_count: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[1] && !ref($_[0]{'arguments'}[1]) ? : 0 0 0
Condition0%0/3
defined $_[0]{"arguments"}[1] and not ref $_[0]{"arguments"}[1]
!ll&&!rl&&r
000
MC/DC0%0/2
defined $_[0]{"arguments"}[1] and not ref $_[0]{"arguments"}[1]
defined $_[0]{"arguments"}[1] not ref $_[0]{"arguments"}[1]
Truth table0%0/3
A and not(B)
A= defined $_[0]{"arguments"}[1]B= not ref $_[0]{"arguments"}[1]
ABresult
0X0
100
111
71 0 ▶sub db_max_count { return 1; }
Subroutine db_max_count: not called CC=1 SCAR=6.9
72  
73 1 1;
« Shopify/Multiplexer.pm ↑ Summary Shopify/Field/String.pm »