| 1 | package JSON::TypeInference::Type::Maybe; | ||||||||||||||||||||
| 2 | 4 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 4 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 4 | ▶ | use List::Util qw(any); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | # ArrayRef[JSON::TypeInference::Type] => Bool | ||||||||||||||||||||
| 8 | 26 | ▶ | sub looks_like_maybe { | ||||||||||||||||||
|
Subroutine
looks_like_maybe: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 9 | 26 | my ($class, $candidate_types) = @_; | |||||||||||||||||||
| 10 | 26 | ▶ | return (scalar(@$candidate_types) == 2) && any { $_->isa('JSON::TypeInference::Type::Null') } @$candidate_types; | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Condition100%3/3
scalar @$candidate_types == 2 && &any(sub {
$_->isa('JSON::TypeInference::Type::Null');
}
, @$candidate_types)
MC/DC100%2/2
scalar @$candidate_types == 2 && &any(sub {
$_->isa('JSON::TypeInference::Type::Null');
}
, @$candidate_types)
scalar @$candidate_types == 2
&any(sub {
$_->isa('JSON::TypeInference::Type::Null');
}
, @$candidate_types)
Truth table100%3/3
A && B
A= scalar @$candidate_types == 2B= &any(sub {
$_->isa('JSON::TypeInference::Type::Null');
}
, @$candidate_types)
| |||||||||||||||||||||
| 11 | } | ||||||||||||||||||||
| 12 | |||||||||||||||||||||
| 13 | 2 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 14 | 2 | my ($class, $type) = @_; | |||||||||||||||||||
| 15 | 2 | return bless { type => $type }, $class; | |||||||||||||||||||
| 16 | } | ||||||||||||||||||||
| 17 | |||||||||||||||||||||
| 18 | 0 | ▶ | sub name { | ||||||||||||||||||
|
Subroutine
name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||
| 19 | 0 | my ($class) = @_; | |||||||||||||||||||
| 20 | 0 | return 'maybe'; | |||||||||||||||||||
| 21 | } | ||||||||||||||||||||
| 22 | |||||||||||||||||||||
| 23 | 2 | ▶ | sub type { | ||||||||||||||||||
|
Subroutine
type: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 24 | 2 | my ($self) = @_; | |||||||||||||||||||
| 25 | 2 | return $self->{type}; | |||||||||||||||||||
| 26 | } | ||||||||||||||||||||
| 27 | |||||||||||||||||||||
| 28 | 1 | ▶ | sub signature { | ||||||||||||||||||
|
Subroutine
signature: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 29 | 1 | my ($self) = @_; | |||||||||||||||||||
| 30 | 1 | return sprintf 'maybe[%s]', $self->type->signature; | |||||||||||||||||||
| 31 | } | ||||||||||||||||||||
| 32 | |||||||||||||||||||||
| 33 | 7 | ▶ | sub accepts { | ||||||||||||||||||
|
Subroutine
accepts: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 34 | 7 | my ($class, $data) = @_; | |||||||||||||||||||
| 35 | 7 | return 0; | |||||||||||||||||||
| 36 | } | ||||||||||||||||||||
| 37 | |||||||||||||||||||||
| 38 | 4 | 1; | |||||||||||||||||||
| 39 | __END__ | ||||||||||||||||||||