Rx/CoreType/all.pm

filter: Statementstmt 100% 27 / 27 Branchbran 100% 6 / 6 Conditioncond 50.0% 3 / 6 MC/DCmcdc 33.3% 1 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 3 totaltotal 84.6% 44 / 52 CC 7 SCAR 12.6
CC
7
Cov
92%
guts_from_arg
6.1
assert_valid
2.0
BEGIN
1.0
CRAP 3.5
« Rx/Util.pm ↑ Summary Rx/CoreType/any.pm »
1 1 ▶use v5.12.0;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 package Data::Rx::CoreType::all 0.200008;
4 # ABSTRACT: the Rx //all type
5  
6 1 ▶use parent 'Data::Rx::CoreType';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 1 ▶use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 5 ▶sub guts_from_arg {
Subroutine guts_from_arg: called CC=6 SCAR=18.2
Pod undocumented
11 5 my ($class, $arg, $rx, $type) = @_;
12  
13 5 ▶ Carp::croak("unknown arguments to new")
Branch: 1 branch
BranchTrueFalseTotal
unless "Data::Rx::Util"->_x_subset_keys_y($arg, {"of", 1}) 1 4 5
14 unless Data::Rx::Util->_x_subset_keys_y($arg, { of => 1});
15  
16 4 ▶ Carp::croak("no 'of' parameter given to //all") unless exists $arg->{of};
Branch: 1 branch
BranchTrueFalseTotal
unless exists $arg->{"of"} 1 3 4
17  
18 3 my $of = $arg->{of};
19  
20 3 ▶ Carp::croak("invalid 'of' argument to //all") unless
Branch: 1 branch
BranchTrueFalseTotal
unless defined $of and builtin::reftype($of) eq "ARRAY" and @$of 1 2 3
Condition50%3/6
defined $of and builtin::reftype($of) eq "ARRAY" and @$of
!ll&&!rl&&r
012
defined $of and builtin::reftype($of) eq "ARRAY"
!ll&&!rl&&r
003
MC/DC33%1/3
defined $of and builtin::reftype($of) eq "ARRAY" and @$of
defined $of builtin::reftype($of) eq "ARRAY" @$of
Truth table50%2/4
A and B and C
A= defined $ofB= builtin::reftype($of) eq "ARRAY"C= @$of
ABCresult
0XX0
10X0
1100
1111
21 defined $of and Scalar::Util::reftype $of eq 'ARRAY' and @$of;
22  
23 2 return { of => [ map {; $rx->make_schema($_) } @$of ] };
24 }
25  
26 53 ▶sub assert_valid {
Subroutine assert_valid: called CC=2 SCAR=6.9
Pod undocumented
27 53 my ($self, $value) = @_;
28  
29 53 my @subchecks;
30 53 for my $i (0 .. $#{ $self->{of} }) {
31 push @subchecks, [
32 $value,
33 106 $self->{of}[$i],
34 {
35 check_path => [ [ 'of', 'key'], [ $i, 'index' ] ],
36 }
37 ];
38 }
39  
40 53 $self->perform_subchecks(\@subchecks);
41  
42 2 return 1;
43 }
44  
45 70 ▶sub subname { 'all' }
Subroutine subname: called CC=1 SCAR=0.0
Pod undocumented
46  
47 1 1;
48  
49 __END__
« Rx/Util.pm ↑ Summary Rx/CoreType/any.pm »