| 1 | package GraphQL::Houtou::Type::List; | ||||||||||||||||||||||||||||
| 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 | 603 | ▶ | sub new { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=8 SCAR=21.4
Pod
undocumented
| |||||||||||||||||||||||||||||
| 12 | 603 | my ($class, %args) = @_; | |||||||||||||||||||||||||||
| 13 | 603 | ▶ | croak "Type::List->new requires 'of'\n" if !exists $args{of}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | my $self = bless { | ||||||||||||||||||||||||||||
| 16 | of => $args{of}, | ||||||||||||||||||||||||||||
| 17 | 603 | ▶ | is_introspection => $args{is_introspection} ? 1 : 0, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | }, $class; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 603 | my $of = $self->{of}; | |||||||||||||||||||||||||||
| 21 | 603 | my @roles; | |||||||||||||||||||||||||||
| 22 | 603 | ▶ | push @roles, 'GraphQL::Houtou::Role::Input' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$of->DOES("GraphQL::Houtou::Role::Input") or $of->DOES("GraphQL::Role::Input")
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")
| |||||||||||||||||||||||||||||
| 23 | if $of->DOES('GraphQL::Houtou::Role::Input') || $of->DOES('GraphQL::Role::Input'); | ||||||||||||||||||||||||||||
| 24 | 603 | ▶ | push @roles, 'GraphQL::Houtou::Role::Output' | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
$of->DOES("GraphQL::Houtou::Role::Output") or $of->DOES("GraphQL::Role::Output")
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")
| |||||||||||||||||||||||||||||
| 25 | if $of->DOES('GraphQL::Houtou::Role::Output') || $of->DOES('GraphQL::Role::Output'); | ||||||||||||||||||||||||||||
| 26 | 603 | ▶ | Role::Tiny->apply_roles_to_object($self, @roles) if @roles; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||
| 28 | 603 | return $self; | |||||||||||||||||||||||||||
| 29 | } | ||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub list { | ||||||||||||||||||||||||||
|
Subroutine
list: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 32 | 0 | ▶ | $_[0]->{_houtou_list} ||= __PACKAGE__->new(of => $_[0]); | ||||||||||||||||||||||||||
|
Condition0%0/3
$_[0]{"_houtou_list"} ||= __PACKAGE__->new("of", $_[0])
MC/DC0%0/2
$_[0]{"_houtou_list"} ||= __PACKAGE__->new("of", $_[0])
$_[0]{"_houtou_list"}
__PACKAGE__->new("of", $_[0])
Truth table0%0/3
A ||= B
A= $_[0]{"_houtou_list"}B= __PACKAGE__->new("of", $_[0])
| |||||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 363 | ▶ | sub non_null { | ||||||||||||||||||||||||||
|
Subroutine
non_null: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 36 | 363 | require GraphQL::Houtou::Type::NonNull; | |||||||||||||||||||||||||||
| 37 | 363 | ▶ | $_[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])
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])
| |||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 25266 | ▶ | sub of { | ||||||||||||||||||||||||||
|
Subroutine
of: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 41 | 25266 | return $_[0]->{of}; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | 2213 | ▶ | sub name { | ||||||||||||||||||||||||||
|
Subroutine
name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 45 | 2213 | return $_[0]->of->name; | |||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||
| 48 | 12567 | ▶ | sub to_string { | ||||||||||||||||||||||||||
|
Subroutine
to_string: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 49 | 12567 | ▶ | $_[0]->{to_string} ||= '[' . $_[0]->of->to_string . ']'; | ||||||||||||||||||||||||||
|
Condition100%2/2
$_[0]{"to_string"} ||= '[' . $_[0]->of->to_string . ']'
MC/DC100%1/1
$_[0]{"to_string"} ||= '[' . $_[0]->of->to_string . ']'
$_[0]{"to_string"}
Truth table100%2/2
A
A= $_[0]{"to_string"}
| |||||||||||||||||||||||||||||
| 50 | } | ||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||
| 52 | 0 | ▶ | sub is_valid { | ||||||||||||||||||||||||||
|
Subroutine
is_valid: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||
| 53 | 0 | my ($self, $item) = @_; | |||||||||||||||||||||||||||
| 54 | 0 | my $of = $self->of; | |||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||
| 56 | 0 | ▶ | return 1 if !defined $item; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | return if grep { !$of->is_valid($_) } @{ $self->uplift($item) }; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 58 | 0 | return 1; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 835 | ▶ | sub uplift { | ||||||||||||||||||||||||||
|
Subroutine
uplift: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 62 | 835 | my ($self, $item) = @_; | |||||||||||||||||||||||||||
| 63 | 835 | ▶ | return $item if ref($item) eq 'ARRAY' || !defined $item; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $item eq "ARRAY" or not defined $item
MC/DC50%1/2
ref $item eq "ARRAY" or not defined $item
ref $item eq "ARRAY"
not defined $item
Truth table66%2/3
A or not(B)
A= ref $item eq "ARRAY"B= not defined $item
| |||||||||||||||||||||||||||||
| 64 | 1 | return [ $item ]; | |||||||||||||||||||||||||||
| 65 | } | ||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||
| 67 | 835 | ▶ | sub graphql_to_perl { | ||||||||||||||||||||||||||
|
Subroutine
graphql_to_perl: called CC=4 SCAR=14.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 68 | 835 | my ($self, $item) = @_; | |||||||||||||||||||||||||||
| 69 | 835 | my $of = $self->of; | |||||||||||||||||||||||||||
| 70 | 835 | my $i = 0; | |||||||||||||||||||||||||||
| 71 | 835 | my @errors; | |||||||||||||||||||||||||||
| 72 | my @values; | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 835 | ▶ | return $item if !defined $item; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 75 | 835 | $item = $self->uplift($item); | |||||||||||||||||||||||||||
| 76 | @values = map { | ||||||||||||||||||||||||||||
| 77 | 835 | my $value = eval { $of->graphql_to_perl($_) }; | |||||||||||||||||||||||||||
| 78 | 3492 | ▶ | push @errors, qq{In element #$i: $@} if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 79 | 3492 | $i++; | |||||||||||||||||||||||||||
| 80 | 3492 | $value; | |||||||||||||||||||||||||||
| 81 | } @$item; | ||||||||||||||||||||||||||||
| 82 | 835 | ▶ | die @errors if @errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 83 | 835 | return \@values; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub perl_to_graphql { | ||||||||||||||||||||||||||
|
Subroutine
perl_to_graphql: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 87 | 0 | my ($self, $item) = @_; | |||||||||||||||||||||||||||
| 88 | 0 | my $of = $self->of; | |||||||||||||||||||||||||||
| 89 | 0 | my $i = 0; | |||||||||||||||||||||||||||
| 90 | 0 | my @errors; | |||||||||||||||||||||||||||
| 91 | my @values; | ||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||
| 93 | 0 | ▶ | return $item if !defined $item; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 94 | 0 | $item = $self->uplift($item); | |||||||||||||||||||||||||||
| 95 | @values = map { | ||||||||||||||||||||||||||||
| 96 | 0 | my $value = eval { $of->perl_to_graphql($_) }; | |||||||||||||||||||||||||||
| 97 | 0 | ▶ | push @errors, qq{In element #$i: $@} if $@; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 98 | 0 | $i++; | |||||||||||||||||||||||||||
| 99 | 0 | $value; | |||||||||||||||||||||||||||
| 100 | } @$item; | ||||||||||||||||||||||||||||
| 101 | 0 | ▶ | die @errors if @errors; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 102 | 0 | return \@values; | |||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||
| 105 | 0 | ▶ | sub _complete_value { | ||||||||||||||||||||||||||
|
Subroutine
_complete_value: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 106 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 107 | 0 | die "Type::List->_complete_value is part of the removed legacy execution path; use GraphQL::Houtou::Schema->build_runtime or ->build_native_runtime for list completion on '@{[$self->to_string]}'.\n"; | |||||||||||||||||||||||||||
| 108 | } | ||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||
| 110 | 62 | 1; | |||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||
| 112 | __END__ | ||||||||||||||||||||||||||||