blib/lib/GraphQL/Houtou/Type/NonNull.pm

filter: Statementstmt 92.1% 35 / 38 Branchbran 64.2% 9 / 14 Conditioncond 57.1% 8 / 14 MC/DCmcdc 33.3% 3 / 9 Subroutinesub 92.3% 12 / 13 Podpod 0.0% 0 / 7 totaltotal 70.5% 67 / 95 CC 13 SCAR 16.0
CC
13
Cov
79%
is_valid
12.0
new
8.5
list
2.0
CRAP 5.0
« blib/lib/GraphQL/Houtou/Runtime/Slot.pm ↑ Summary blib/lib/GraphQL/Houtou/Type/Enum.pm »
1 package GraphQL::Houtou::Type::NonNull;
2  
3 62 ▶use 5.014;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 62 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 62 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 62 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 62 ▶use parent 'GraphQL::Houtou::Type';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 62 ▶use Role::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 950 ▶sub new {
Subroutine new: called CC=8 SCAR=21.4
Pod undocumented
12 950 my ($class, %args) = @_;
13 950 ▶ croak "Type::NonNull->new requires 'of'\n" if !exists $args{of};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args{"of"} 0 950 950
14  
15 my $self = bless {
16 of => $args{of},
17 950 ▶ is_introspection => $args{is_introspection} ? 1 : 0,
Branch: 1 branch
BranchTrueFalseTotal
$args{'is_introspection'} ? : 0 950 950
18 }, $class;
19  
20 950 my $of = $self->{of};
21 950 my @roles;
22 950 ▶ push @roles, 'GraphQL::Houtou::Role::Input'
Branch: 1 branch
BranchTrueFalseTotal
if $of->DOES("GraphQL::Houtou::Role::Input") or $of->DOES("GraphQL::Role::Input") 384 566 950
Condition66%2/3
$of->DOES("GraphQL::Houtou::Role::Input") or $of->DOES("GraphQL::Role::Input")
l!l&&r!l&&!r
3840566
MC/DC50%1/2
$of->DOES("GraphQL::Houtou::Role::Input") or $of->DOES("GraphQL::Role::Input")
$of->DOES("GraphQL::Houtou::Role::Input") $of->DOES("GraphQL::Role::Input")
Truth table66%2/3
A or B
A= $of->DOES("GraphQL::Houtou::Role::Input")B= $of->DOES("GraphQL::Role::Input")
ABresult
1X1
011
000
23 if $of->DOES('GraphQL::Houtou::Role::Input') || $of->DOES('GraphQL::Role::Input');
24 950 ▶ push @roles, 'GraphQL::Houtou::Role::Output'
Branch: 1 branch
BranchTrueFalseTotal
if $of->DOES("GraphQL::Houtou::Role::Output") or $of->DOES("GraphQL::Role::Output") 943 7 950
Condition66%2/3
$of->DOES("GraphQL::Houtou::Role::Output") or $of->DOES("GraphQL::Role::Output")
l!l&&r!l&&!r
94307
MC/DC50%1/2
$of->DOES("GraphQL::Houtou::Role::Output") or $of->DOES("GraphQL::Role::Output")
$of->DOES("GraphQL::Houtou::Role::Output") $of->DOES("GraphQL::Role::Output")
Truth table66%2/3
A or B
A= $of->DOES("GraphQL::Houtou::Role::Output")B= $of->DOES("GraphQL::Role::Output")
ABresult
1X1
011
000
25 if $of->DOES('GraphQL::Houtou::Role::Output') || $of->DOES('GraphQL::Role::Output');
26 950 ▶ Role::Tiny->apply_roles_to_object($self, @roles) if @roles;
Branch: 1 branch
BranchTrueFalseTotal
if @roles 950 0 950
27  
28 950 return $self;
29 }
30  
31 618 ▶sub list {
Subroutine list: called CC=2 SCAR=7.1
Pod undocumented
32 618 require GraphQL::Houtou::Type::List;
33 618 ▶ $_[0]->{_houtou_list} ||= GraphQL::Houtou::Type::List->new(of => $_[0]);
Condition66%2/3
$_[0]{"_houtou_list"} ||= "GraphQL::Houtou::Type::List"->new("of", $_[0])
l!l&&r!l&&!r
2184000
MC/DC0%0/2
$_[0]{"_houtou_list"} ||= "GraphQL::Houtou::Type::List"->new("of", $_[0])
$_[0]{"_houtou_list"} "GraphQL::Houtou::Type::List"->new("of", $_[0])
Truth table66%2/3
A ||= B
A= $_[0]{"_houtou_list"}B= "GraphQL::Houtou::Type::List"->new("of", $_[0])
ABresult
1X1
011
000
34 }
35  
36 59303 ▶sub of {
Subroutine of: called CC=1 SCAR=0.0
Pod undocumented
37 59303 return $_[0]->{of};
38 }
39  
40 5841 ▶sub name {
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
41 5841 return $_[0]->of->name;
42 }
43  
44 32408 ▶sub to_string {
Subroutine to_string: called CC=2 SCAR=6.9
Pod undocumented
45 32408 ▶ $_[0]->{to_string} ||= $_[0]->of->to_string . '!';
Condition100%2/2
$_[0]{"to_string"} ||= $_[0]->of->to_string . '!'
l!l
31815593
MC/DC100%1/1
$_[0]{"to_string"} ||= $_[0]->of->to_string . '!'
$_[0]{"to_string"}
Truth table100%2/2
A
A= $_[0]{"to_string"}
Aresult
11
00
46 }
47  
48 0 ▶sub is_valid {
Subroutine is_valid: not called CC=3 SCAR=24.8
Pod undocumented
49 0 my ($self, $item) = @_;
50 0 ▶ return if !defined $item || !$self->of->is_valid($item);
Branch: 1 branch
BranchTrueFalseTotal
unless defined $item and $self->of->is_valid($item) 0 0 0
Condition0%0/3
defined $item and $self->of->is_valid($item)
!ll&&!rl&&r
000
MC/DC0%0/2
defined $item and $self->of->is_valid($item)
defined $item $self->of->is_valid($item)
Truth table0%0/3
A and B
A= defined $itemB= $self->of->is_valid($item)
ABresult
0X0
100
111
51 0 return 1;
52 }
53  
54 133 ▶sub graphql_to_perl {
Subroutine graphql_to_perl: called CC=2 SCAR=6.9
Pod undocumented
55 133 my ($self, $item) = @_;
56 133 my $value = $self->of->graphql_to_perl($item);
57 132 ▶ return defined($value) ? $value : die $self->to_string . " given null value.\n";
Branch: 1 branch
BranchTrueFalseTotal
defined $value ? : 128 4 132
58 }
59  
60 62 1;
61  
62 __END__
« blib/lib/GraphQL/Houtou/Runtime/Slot.pm ↑ Summary blib/lib/GraphQL/Houtou/Type/Enum.pm »