blib/lib/WWW/Shopify/Field/Relation.pm

filter: Statementstmt 53.4% 31 / 58 Branchbran 0.0% 0 / 8 Conditioncond 0.0% 0 / 48 MC/DCmcdc 0.0% 0 / 20 Subroutinesub 29.2% 12 / 41 Podpod 0.0% 0 / 16 totaltotal 22.5% 43 / 191 CC 21 SCAR 24.8
CC
21
Cov
27%
is_db_belongs_to
42.0
is_db_has_many
30.0
is_db_many_many
30.0
CRAP 12.0
« blib/lib/WWW/Shopify/Public.pm ↑ Summary blib/lib/WWW/Shopify/Exception.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 sub new {
9 84 ▶ my $package = shift;
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
10 84 my $calling_package = caller(0);
11 84 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 148 ▶sub is_relation { return 1; }
Subroutine is_relation: called CC=1 SCAR=0.0
Pod undocumented
20 84 ▶sub is_many { return undef; }
Subroutine is_many: called CC=1 SCAR=0.0
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 { return !$_[0]->is_db_belongs_to && !$_[0]->is_db_has_one && $_[0]->is_many && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner; }
Subroutine is_db_has_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_many && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner
!ll&&!rl&&r
000
not $_[0]->is_db_belongs_to || $_[0]->is_db_has_one and $_[0]->is_many and $_[0]->relation->parent
!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
MC/DC0%0/5
!($_[0]->is_db_belongs_to || $_[0]->is_db_has_one) && $_[0]->is_many && $_[0]->relation->parent && $_[0]->relation->parent eq $_[0]->owner
$_[0]->is_db_belongs_to $_[0]->is_db_has_one $_[0]->is_many $_[0]->relation->parent $_[0]->relation->parent eq $_[0]->owner
Truth table0%0/6
not(A || B) and C and D && E
A= $_[0]->is_db_belongs_toB= $_[0]->is_db_has_oneC= $_[0]->is_manyD= $_[0]->relation->parentE= $_[0]->relation->parent eq $_[0]->owner
ABCDEresult
1XXXX0
01XXX0
000XX0
0010X0
001100
001111
30 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
31 ▶sub db_min_count { }
Subroutine db_min_count: not called CC=1 SCAR=0.0
Pod undocumented
32 ▶sub db_max_count { }
Subroutine db_max_count: not called CC=1 SCAR=0.0
Pod undocumented
33 1 ▶use Math::Round qw(round);
Subroutine BEGIN: called CC=1 SCAR=0.0
34 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
35  
36 package WWW::Shopify::Field::Relation::Parent;
37 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
38 0 ▶sub is_parent { return 1; }
Subroutine is_parent: not called CC=1 SCAR=6.9
39 0 ▶sub is_reference { return 1; }
Subroutine is_reference: not called CC=1 SCAR=6.9
40 0 ▶sub is_one { return 1; }
Subroutine is_one: not called CC=1 SCAR=6.9
41  
42 0 ▶sub db_min_count { return 1; }
Subroutine db_min_count: not called CC=1 SCAR=6.9
43 0 ▶sub db_max_count { return 1; }
Subroutine db_max_count: not called CC=1 SCAR=6.9
44  
45 package WWW::Shopify::Field::Relation::Many;
46 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
47 64 ▶sub is_many { return 1; }
Subroutine is_many: called CC=1 SCAR=0.0
48  
49 0 ▶sub db_min_count { return defined $_[0]->{arguments}->[1] ? $_[0]->{arguments}->[1] : 0; }
Subroutine db_min_count: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[1] ? : 0 0 0
50 0 ▶sub db_max_count { return defined $_[0]->{arguments}->[2] ? $_[0]->{arguments}->[2] : 5; }
Subroutine db_max_count: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[2] ? : 0 0 0
51  
52 package WWW::Shopify::Field::Relation::ReferenceOne;
53 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
54 0 ▶sub is_one { return 1; }
Subroutine is_one: not called CC=1 SCAR=6.9
55 0 ▶sub is_reference { return 1; }
Subroutine is_reference: not called CC=1 SCAR=6.9
56 0 ▶sub data_type { return WWW::Shopify::Field->TYPE_QUANTITATIVE; }
Subroutine data_type: not called CC=1 SCAR=6.9
57  
58 0 ▶sub db_min_count { return defined $_[0]->{arguments}->[1] ? $_[0]->{arguments}->[1] : 0; }
Subroutine db_min_count: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[1] ? : 0 0 0
59 0 ▶sub db_max_count { return 1; }
Subroutine db_max_count: not called CC=1 SCAR=6.9
60  
61 package WWW::Shopify::Field::Relation::OwnOne;
62 1 ▶use parent 'WWW::Shopify::Field::Relation';
Subroutine BEGIN: called CC=1 SCAR=0.0
63 0 ▶sub is_one { return 1; }
Subroutine is_one: not called CC=1 SCAR=6.9
64 0 ▶sub is_own { return 1; }
Subroutine is_own: not called CC=1 SCAR=6.9
65  
66 0 ▶sub db_min_count { return defined $_[0]->{arguments}->[1] ? $_[0]->{arguments}->[1] : 0; }
Subroutine db_min_count: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0]{'arguments'}[1] ? : 0 0 0
67 0 ▶sub db_max_count { return 1; }
Subroutine db_max_count: not called CC=1 SCAR=6.9
68  
69 1 1;
« blib/lib/WWW/Shopify/Public.pm ↑ Summary blib/lib/WWW/Shopify/Exception.pm »