| 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
| |||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | my $self = bless { | ||||||||||||||||||||||||||||
| 16 | of => $args{of}, | ||||||||||||||||||||||||||||
| 17 | 950 | ▶ | is_introspection => $args{is_introspection} ? 1 : 0, | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 18 | }, $class; | ||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 950 | my $of = $self->{of}; | |||||||||||||||||||||||||||
| 21 | 950 | my @roles; | |||||||||||||||||||||||||||
| 22 | 950 | ▶ | 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 | 950 | ▶ | 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 | 950 | ▶ | Role::Tiny->apply_roles_to_object($self, @roles) if @roles; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 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])
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])
| |||||||||||||||||||||||||||||
| 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 . '!'
MC/DC100%1/1
$_[0]{"to_string"} ||= $_[0]->of->to_string . '!'
$_[0]{"to_string"}
Truth table100%2/2
A
A= $_[0]{"to_string"}
| |||||||||||||||||||||||||||||
| 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
Condition0%0/3
defined $item and $self->of->is_valid($item)
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)
| |||||||||||||||||||||||||||||
| 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
| |||||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | 62 | 1; | |||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | __END__ | ||||||||||||||||||||||||||||