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

filter: Statementstmt 71.6% 124 / 173 Branchbran 40.4% 51 / 126 Conditioncond 64.2% 18 / 28 MC/DCmcdc 22.2% 4 / 18 Subroutinesub 71.4% 35 / 49 Podpod 0.0% 0 / 14 totaltotal 56.8% 232 / 408 CC 74 SCAR 25.5
CC
74
Cov
59%
_builtin_is_valid
72.0
_builtin_perl_to_graphql
26.5
is_valid
20.0
CRAP 12.9
« blib/lib/GraphQL/Houtou/Validation/DepthLimit.pm ↑ Summary blib/lib/GraphQL/Houtou/Validation/NodeLimit.pm »
1 package GraphQL::Houtou::Type::Scalar;
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 parent 'GraphQL::Houtou::Type';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 62 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 62 ▶use JSON::MaybeXS qw(JSON is_bool);
Subroutine BEGIN: called CC=1 SCAR=0.0
10 62 ▶use Role::Tiny::With;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 62 ▶use Scalar::Util qw(looks_like_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 62 ▶use GraphQL::Houtou::Internal::TypeSupport qw(description_doc_lines named_from_ast);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 62 ▶use GraphQL::Houtou::Type::List ();
Subroutine BEGIN: called CC=1 SCAR=0.0
14 62 ▶use GraphQL::Houtou::Type::NonNull ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 62 with qw(
17 GraphQL::Houtou::Role::Input
18 GraphQL::Houtou::Role::Output
19 GraphQL::Houtou::Role::Leaf
20 );
21  
22 62 our @EXPORT_OK = qw($Int $Float $String $Boolean $ID);
23 62 ▶use constant DEBUG => $ENV{GRAPHQL_DEBUG};
Subroutine BEGIN: called CC=1 SCAR=0.0
24  
25 120 ▶sub list {
Subroutine list: called CC=2 SCAR=7.2
Pod undocumented
26 120 ▶ $_[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
100200
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
27 }
28  
29 1430 ▶sub non_null {
Subroutine non_null: called CC=2 SCAR=7.2
Pod undocumented
30 1430 ▶ $_[0]->{_houtou_non_null} ||= GraphQL::Houtou::Type::NonNull->new(of => $_[0]);
Condition66%2/3
$_[0]{"_houtou_non_null"} ||= "GraphQL::Houtou::Type::NonNull"->new("of", $_[0])
l!l&&r!l&&!r
12651650
MC/DC0%0/2
$_[0]{"_houtou_non_null"} ||= "GraphQL::Houtou::Type::NonNull"->new("of", $_[0])
$_[0]{"_houtou_non_null"} "GraphQL::Houtou::Type::NonNull"->new("of", $_[0])
Truth table66%2/3
A ||= B
A= $_[0]{"_houtou_non_null"}B= "GraphQL::Houtou::Type::NonNull"->new("of", $_[0])
ABresult
1X1
011
000
31 }
32  
33 620 ▶sub _leave_undef {
Subroutine _leave_undef: called CC=1 SCAR=2.6
34 620 my ($closure) = @_;
35 0 ▶ sub { return undef if !defined $_[0]; goto &$closure; };
Subroutine __ANON__: not called CC=2 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
unless defined $_[0] 0 0 0
36 }
37  
38 368 ▶sub new {
Subroutine new: called CC=1 SCAR=0.0
Pod undocumented
39 368 my ($class, %args) = @_;
40 368 my $self = $class->SUPER::new(%args);
41 368 $self->{name} = $args{name};
42 368 $self->{description} = $args{description};
43 368 $self->{serialize} = $args{serialize};
44 368 $self->{parse_value} = $args{parse_value};
45 368 $self->{_builtin_kind} = $args{_builtin_kind};
46 368 $self->{specified_by_url} = $args{specified_by_url};
47 368 return bless $self, $class;
48 }
49  
50 64569 ▶sub name { $_[0]->{name} }
Subroutine name: called CC=1 SCAR=0.0
Pod undocumented
51 4885 ▶sub description { $_[0]->{description} }
Subroutine description: called CC=1 SCAR=0.0
Pod undocumented
52 46644 ▶sub to_string { $_[0]->{to_string} ||= $_[0]->name }
Subroutine to_string: called CC=2 SCAR=7.2
Pod undocumented
Condition66%2/3
$_[0]{"to_string"} ||= $_[0]->name
l!l&&r!l&&!r
463992450
MC/DC0%0/2
$_[0]{"to_string"} ||= $_[0]->name
$_[0]{"to_string"} $_[0]->name
Truth table66%2/3
A ||= B
A= $_[0]{"to_string"}B= $_[0]->name
ABresult
1X1
011
000
53 4943 ▶sub serialize { $_[0]->{serialize} }
Subroutine serialize: called CC=1 SCAR=0.0
Pod undocumented
54 4892 ▶sub parse_value { $_[0]->{parse_value} }
Subroutine parse_value: called CC=1 SCAR=0.0
Pod undocumented
55  
56 49 ▶sub from_ast {
Subroutine from_ast: called CC=5 SCAR=16.2
Pod undocumented
57 49 my ($class, $name2type, $ast_node) = @_;
58 6 ▶ my ($specified_by) = grep { ($_->{name} || q()) eq 'specifiedBy' }
Condition50%1/2
$_->{'name'} || ''
l!l
60
MC/DC0%0/1
$_->{'name'} || ''
$_->{'name'}
Truth table50%1/2
A
A= $_->{'name'}
Aresult
11
00
59 49 ▶ @{ $ast_node->{directives} || [] };
Condition100%2/2
$ast_node->{'directives'} || []
l!l
643
MC/DC100%1/1
$ast_node->{'directives'} || []
$ast_node->{'directives'}
Truth table100%2/2
A
A= $ast_node->{'directives'}
Aresult
11
00
60 return $class->new(
61 named_from_ast($ast_node),
62 # SDL-built custom scalars default to pass-through coercion; override
63 # via the resolvers option of Schema->from_doc or by replacing these.
64 2 ▶ serialize => sub { $_[0] },
Subroutine __ANON__: called CC=1 SCAR=0.0
65 10 ▶ parse_value => sub { $_[0] },
Subroutine __ANON__: called CC=1 SCAR=0.0
66 ($specified_by && defined $specified_by->{arguments}{url}
67 ? (specified_by_url => $specified_by->{arguments}{url})
68 49 ▶ : ()),
Branch: 1 branch
BranchTrueFalseTotal
$specified_by && defined $specified_by->{'arguments'}{'url'} ? : 6 43 49
Condition66%2/3
$specified_by and defined $specified_by->{"arguments"}{"url"}
!ll&&!rl&&r
4306
MC/DC50%1/2
$specified_by and defined $specified_by->{"arguments"}{"url"}
$specified_by defined $specified_by->{"arguments"}{"url"}
Truth table66%2/3
A and B
A= $specified_byB= defined $specified_by->{"arguments"}{"url"}
ABresult
0X0
100
111
69 );
70 }
71  
72 3 ▶sub to_doc {
Subroutine to_doc: called CC=3 SCAR=11.2
Pod undocumented
73 3 my ($self) = @_;
74 3 ▶ return $self->{to_doc} if exists $self->{to_doc};
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{"to_doc"} 0 3 3
75 3 my $line = "scalar @{[$self->name]}";
76 3 ▶ if (defined(my $url = $self->specified_by_url)) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined(my $url = $self->specified_by_url)) 3 0 3
77 3 $line .= ' @specifiedBy(url: '
78 . JSON::MaybeXS->new->utf8(0)->allow_nonref->encode($url) . ')';
79 }
80 3 return $self->{to_doc} = join '', map "$_\n",
81 description_doc_lines($self->description),
82 $line;
83 }
84 7771 ▶sub _builtin_kind { $_[0]->{_builtin_kind} }
Subroutine _builtin_kind: called CC=1 SCAR=0.0
85 4890 ▶sub specified_by_url { $_[0]->{specified_by_url} }
Subroutine specified_by_url: called CC=1 SCAR=0.0
Pod undocumented
86  
87 3863 ▶sub _fast_is_nonref_defined {
Subroutine _fast_is_nonref_defined: called CC=2 SCAR=7.6
88 3863 ▶ defined $_[0] && !ref($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] and not ref $_[0] 3863 0 3863
89 }
90  
91 21 ▶sub _fast_is_int32_signed {
Subroutine _fast_is_int32_signed: called CC=5 SCAR=17.5
92 21 ▶ return if !_fast_is_nonref_defined($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless _fast_is_nonref_defined($_[0]) 0 21 21
93 21 ▶ return if !looks_like_number($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless &looks_like_number($_[0]) 6 15 21
94 15 ▶ return if int($_[0]) != $_[0];
Branch: 1 branch
BranchTrueFalseTotal
if int $_[0] != $_[0] 0 15 15
95 15 ▶ return $_[0] >= -2147483648 && $_[0] <= 2147483647;
Condition33%1/3
$_[0] >= -2147483648 && $_[0] <= 2147483647
!ll&&!rl&&r
0015
MC/DC0%0/2
$_[0] >= -2147483648 && $_[0] <= 2147483647
$_[0] >= -2147483648 $_[0] <= 2147483647
Truth table33%1/3
A && B
A= $_[0] >= -2147483648B= $_[0] <= 2147483647
ABresult
0X0
100
111
96 }
97  
98 0 ▶sub _fast_is_num {
Subroutine _fast_is_num: not called CC=2 SCAR=17.9
99 0 ▶ return if !_fast_is_nonref_defined($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless _fast_is_nonref_defined($_[0]) 0 0 0
100 0 return looks_like_number($_[0]);
101 }
102  
103 3810 ▶sub _fast_is_str {
Subroutine _fast_is_str: called CC=1 SCAR=0.0
104 3810 return _fast_is_nonref_defined($_[0]);
105 }
106  
107 40 ▶sub _fast_is_boolish {
Subroutine _fast_is_boolish: called CC=5 SCAR=16.7
108 40 ▶ return 1 if is_bool($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
if is_bool($_[0]) 8 32 40
109 32 ▶ return if !_fast_is_nonref_defined($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless _fast_is_nonref_defined($_[0]) 0 32 32
110 32 ▶ return if !looks_like_number($_[0]);
Branch: 1 branch
BranchTrueFalseTotal
unless &looks_like_number($_[0]) 0 32 32
111 32 ▶ return $_[0] == 0 || $_[0] == 1;
Condition66%2/3
$_[0] == 0 || $_[0] == 1
l!l&&r!l&&!r
19130
MC/DC0%0/2
$_[0] == 0 || $_[0] == 1
$_[0] == 0 $_[0] == 1
Truth table66%2/3
A || B
A= $_[0] == 0B= $_[0] == 1
ABresult
1X1
011
000
112 }
113  
114 0 ▶sub _builtin_is_valid {
Subroutine _builtin_is_valid: not called CC=8 SCAR=42.8
115 0 my ($self, $item) = @_;
116 0 ▶ my $kind = $self->_builtin_kind or return;
Branch: 1 branch
BranchTrueFalseTotal
my $kind = $self->_builtin_kind or return 0 0 0
117  
118 0 ▶ return 1 if !defined $item;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $item 0 0 0
119 0 ▶ return _fast_is_int32_signed($item) if $kind eq 'Int';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Int" 0 0 0
120 0 ▶ return _fast_is_num($item) if $kind eq 'Float';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Float" 0 0 0
121 0 ▶ return _fast_is_str($item) if $kind eq 'String';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "String" 0 0 0
122 0 ▶ return _fast_is_boolish($item) if $kind eq 'Boolean';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "Boolean" 0 0 0
123 0 ▶ return _fast_is_str($item) if $kind eq 'ID';
Branch: 1 branch
BranchTrueFalseTotal
if $kind eq "ID" 0 0 0
124 0 return;
125 }
126  
127 3860 ▶sub _builtin_graphql_to_perl {
Subroutine _builtin_graphql_to_perl: called CC=14 SCAR=27.8
128 3860 my ($self, $item) = @_;
129 3860 ▶ my $kind = $self->_builtin_kind or return;
Branch: 1 branch
BranchTrueFalseTotal
my $kind = $self->_builtin_kind or return 3860 0 3860
130  
131 3860 ▶ return $item if !defined $item;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $item 4 3856 3860
132  
133 3856 ▶ if ($kind eq 'Int') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Int") 21 3835 3856
134 21 ▶ _fast_is_int32_signed($item) or die "Not an Int.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_int32_signed($item) or die "Not an Int.\n" 15 6 21
135 15 return $item + 0;
136 }
137 3835 ▶ if ($kind eq 'Float') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Float") 0 3835 3835
138 0 ▶ _fast_is_num($item) or die "Not a Float.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_num($item) or die "Not a Float.\n" 0 0 0
139 0 return $item + 0;
140 }
141 3835 ▶ if ($kind eq 'String') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "String") 3783 52 3835
142 3783 ▶ _fast_is_str($item) or die "Not a String.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($item) or die "Not a String.\n" 3782 1 3783
143 3782 return $item;
144 }
145 52 ▶ if ($kind eq 'Boolean') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Boolean") 30 22 52
146 30 ▶ _fast_is_boolish($item) or die "Not a Boolean.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_boolish($item) or die "Not a Boolean.\n" 30 0 30
147 30 ▶ return $item ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$item ? : 18 12 30
148 }
149 22 ▶ if ($kind eq 'ID') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "ID") 22 0 22
150 22 ▶ _fast_is_str($item) or die "Not an ID.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($item) or die "Not an ID.\n" 22 0 22
151 22 return $item;
152 }
153  
154 0 return;
155 }
156  
157 15 ▶sub _builtin_perl_to_graphql {
Subroutine _builtin_perl_to_graphql: called CC=14 SCAR=32.8
158 15 my ($self, $item) = @_;
159 15 ▶ my $kind = $self->_builtin_kind or return;
Branch: 1 branch
BranchTrueFalseTotal
my $kind = $self->_builtin_kind or return 15 0 15
160  
161 15 ▶ return $item if !defined $item;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $item 0 15 15
162  
163 15 ▶ if ($kind eq 'Int') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Int") 0 15 15
164 0 ▶ _fast_is_int32_signed($item) or die "Not an Int.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_int32_signed($item) or die "Not an Int.\n" 0 0 0
165 0 return $item + 0;
166 }
167 15 ▶ if ($kind eq 'Float') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Float") 0 15 15
168 0 ▶ _fast_is_num($item) or die "Not a Float.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_num($item) or die "Not a Float.\n" 0 0 0
169 0 return $item + 0;
170 }
171 15 ▶ if ($kind eq 'String') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "String") 2 13 15
172 2 ▶ _fast_is_str($item) or die "Not a String.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($item) or die "Not a String.\n" 2 0 2
173 2 return $item . '';
174 }
175 13 ▶ if ($kind eq 'Boolean') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "Boolean") 10 3 13
176 10 ▶ _fast_is_boolish($item) or die "Not a Boolean.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_boolish($item) or die "Not a Boolean.\n" 10 0 10
177 10 ▶ return $item ? JSON->true : JSON->false;
Branch: 1 branch
BranchTrueFalseTotal
$item ? : 0 10 10
178 }
179 3 ▶ if ($kind eq 'ID') {
Branch: 1 branch
BranchTrueFalseTotal
if ($kind eq "ID") 3 0 3
180 3 ▶ _fast_is_str($item) or die "Not an ID.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($item) or die "Not an ID.\n" 3 0 3
181 3 return $item . '';
182 }
183  
184 0 return;
185 }
186  
187 0 ▶sub is_valid {
Subroutine is_valid: not called CC=4 SCAR=30.0
Pod undocumented
188 0 my ($self, $item) = @_;
189 0 ▶ my $fast = $self->_builtin_kind ? $self->_builtin_is_valid($item) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->_builtin_kind ? : 0 0 0
190 0 ▶ return $fast if defined $fast;
Branch: 1 branch
BranchTrueFalseTotal
if defined $fast 0 0 0
191 0 ▶ return 1 if !defined $item;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $item 0 0 0
192 0 return eval { $self->serialize->($item); 1 };
193 }
194  
195 3881 ▶sub graphql_to_perl {
Subroutine graphql_to_perl: called CC=4 SCAR=13.9
Pod undocumented
196 3881 my ($self, $item) = @_;
197 3881 ▶ my $fast = $self->_builtin_kind ? $self->_builtin_graphql_to_perl($item) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->_builtin_kind ? : 3860 21 3881
198 3874 ▶ return $fast if defined $fast || !defined $item;
Branch: 1 branch
BranchTrueFalseTotal
if defined $fast or not defined $item 3853 21 3874
Condition100%3/3
defined $fast or not defined $item
l!l&&r!l&&!r
3849421
MC/DC100%2/2
defined $fast or not defined $item
defined $fast not defined $item
Truth table100%3/3
A or not(B)
A= defined $fastB= not defined $item
ABresult
1X1
011
000
199 21 return $self->parse_value->($item);
200 }
201  
202 15 ▶sub perl_to_graphql {
Subroutine perl_to_graphql: called CC=4 SCAR=17.1
Pod undocumented
203 15 my ($self, $item) = @_;
204 15 ▶ my $fast = $self->_builtin_kind ? $self->_builtin_perl_to_graphql($item) : undef;
Branch: 1 branch
BranchTrueFalseTotal
$self->_builtin_kind ? : 15 0 15
205 15 ▶ return $fast if defined $fast || !defined $item;
Branch: 1 branch
BranchTrueFalseTotal
if defined $fast or not defined $item 15 0 15
Condition33%1/3
defined $fast or not defined $item
l!l&&r!l&&!r
1500
MC/DC0%0/2
defined $fast or not defined $item
defined $fast not defined $item
Truth table33%1/3
A or not(B)
A= defined $fastB= not defined $item
ABresult
1X1
011
000
206 0 return $self->serialize->($item);
207 }
208  
209 our $Int = __PACKAGE__->new(
210 _builtin_kind => 'Int',
211 name => 'Int',
212 description =>
213 'The `Int` scalar type represents non-fractional signed whole numeric ' .
214 'values. Int can represent values between -(2^31) and 2^31 - 1.',
215 0 ▶ serialize => _leave_undef(sub { !_fast_is_int32_signed($_[0]) and die "Not an Int.\n"; $_[0] + 0 }),
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_int32_signed($_[0]) or die "Not an Int.\n" 0 0 0
216 0 ▶ parse_value => _leave_undef(sub { !_fast_is_int32_signed($_[0]) and die "Not an Int.\n"; $_[0] + 0 }),
Subroutine __ANON__: not called CC=2 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_int32_signed($_[0]) or die "Not an Int.\n" 0 0 0
217 );
218  
219 our $Float = __PACKAGE__->new(
220 _builtin_kind => 'Float',
221 name => 'Float',
222 description =>
223 'The `Float` scalar type represents signed double-precision fractional ' .
224 'values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).',
225 0 ▶ serialize => _leave_undef(sub { !_fast_is_num($_[0]) and die "Not a Float.\n"; $_[0] + 0 }),
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_num($_[0]) or die "Not a Float.\n" 0 0 0
226 0 ▶ parse_value => _leave_undef(sub { !_fast_is_num($_[0]) and die "Not a Float.\n"; $_[0] + 0 }),
Subroutine __ANON__: not called CC=2 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_num($_[0]) or die "Not a Float.\n" 0 0 0
227 );
228  
229 our $String = __PACKAGE__->new(
230 _builtin_kind => 'String',
231 name => 'String',
232 description =>
233 'The `String` scalar type represents textual data, represented as UTF-8 ' .
234 'character sequences. The String type is most often used by GraphQL to ' .
235 'represent free-form human-readable text.',
236 0 ▶ serialize => _leave_undef(sub { !_fast_is_str($_[0]) and die "Not a String.\n"; $_[0] . '' }),
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($_[0]) or die "Not a String.\n" 0 0 0
237 0 ▶ parse_value => _leave_undef(sub { !_fast_is_str($_[0]) and die "Not a String.\n"; $_[0] }),
Subroutine __ANON__: not called CC=2 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($_[0]) or die "Not a String.\n" 0 0 0
238 );
239  
240 our $Boolean = __PACKAGE__->new(
241 _builtin_kind => 'Boolean',
242 name => 'Boolean',
243 description => 'The `Boolean` scalar type represents `true` or `false`.',
244 0 ▶ serialize => _leave_undef(sub {
Subroutine __ANON__: not called CC=3 SCAR=24.8
245 0 ▶ !_fast_is_boolish($_[0]) and die "Not a Boolean.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_boolish($_[0]) or die "Not a Boolean.\n" 0 0 0
246 0 ▶ $_[0] ? JSON->true : JSON->false;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 0 0 0
247 }),
248 0 ▶ parse_value => _leave_undef(sub {
Subroutine __ANON__: not called CC=2 SCAR=17.9
249 0 ▶ !_fast_is_boolish($_[0]) and die "Not a Boolean.\n";
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_boolish($_[0]) or die "Not a Boolean.\n" 0 0 0
250 0 $_[0] + 0;
251 62 }),
252 );
253  
254 our $ID = __PACKAGE__->new(
255 _builtin_kind => 'ID',
256 name => 'ID',
257 description =>
258 'The `ID` scalar type represents a unique identifier, often used to ' .
259 'refetch an object or as key for a cache. The ID type appears in a JSON ' .
260 'response as a String; however, it is not intended to be human-readable. ' .
261 'When expected as an input type, any string (such as `"4"`) or integer ' .
262 '(such as `4`) input value will be accepted as an ID.',
263 0 ▶ serialize => _leave_undef(sub { !_fast_is_str($_[0]) and die "Not an ID.\n"; $_[0] . '' }),
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($_[0]) or die "Not an ID.\n" 0 0 0
264 0 ▶ parse_value => _leave_undef(sub { !_fast_is_str($_[0]) and die "Not an ID.\n"; $_[0] }),
Subroutine __ANON__: not called CC=2 SCAR=14.0
Branch: 1 branch
BranchTrueFalseTotal
_fast_is_str($_[0]) or die "Not an ID.\n" 0 0 0
265 );
266  
267 62 1;
268  
269 __END__
« blib/lib/GraphQL/Houtou/Validation/DepthLimit.pm ↑ Summary blib/lib/GraphQL/Houtou/Validation/NodeLimit.pm »