Valiant/Proxy/Array.pm

filter: Statementstmt 100% 9 / 9 Branchbran 100% 2 / 2 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 2 / 2 Podpod 0.0% 0 / 1 totaltotal 84.2% 16 / 19 CC 3 SCAR 9.2
CC
3
Cov
93%
read_attribute_for_validation
3.0
BEGIN
1.0
CRAP 2.5
« Valiant/Proxy.pm ↑ Summary Valiant/Validator/Boolean.pm »
1 package Valiant::Proxy::Array;
2  
3 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 with 'Valiant::Proxy';
5  
6 sub read_attribute_for_validation {
7 35 ▶ my ($self, $attribute) = @_;
Subroutine read_attribute_for_validation: called CC=3 SCAR=11.0
Pod undocumented
8 35 ▶ if( $attribute=~m/^\d+$/ && defined $self->for->[$attribute]) {
Branch: 1 branch
BranchTrueFalseTotal
if ($attribute =~ /^\d+$/ and defined $self->for->[$attribute]) { } 28 7 35
Condition66%2/3
$attribute =~ /^\d+$/ and defined $self->for->[$attribute]
!ll&&!rl&&r
7028
MC/DC50%1/2
$attribute =~ /^\d+$/ and defined $self->for->[$attribute]
$attribute =~ /^\d+$/ defined $self->for->[$attribute]
Truth table66%2/3
A and B
A= $attribute =~ /^\d+$/B= defined $self->for->[$attribute]
ABresult
0X0
100
111
9 28 return $self->for->[$attribute];
10 } else {
11 7 return undef; # TODO Might need a flag to allow die here?
12 }
13 }
14  
15 2 1;
16  
17 =head1 NAME
18  
19 Valiant::Proxy::Array - Wrap a hashref in a result object for validation.
20  
21 =head1 SYNOPSIS
22  
23 TBD
24  
25 =head1 DESCRIPTION
26  
27 Allows you to run validations against a HashRef.
28  
29 You probably won't use this directly (although you can) since we have L<Valiant::Class> to
30 encapsulate the most common patterns for this need.
31  
32 =head1 SEE ALSO
33  
34 This does the interface defined by L<Valiant::Result> so see the docs on that.
35
36 Also: L<Valiant>, L<Valiant::Validator>, L<Valiant::Validator::Each>.
37  
38 =head1 AUTHOR
39
40 See L<Valiant>
41  
42 =head1 COPYRIGHT & LICENSE
43
44 See L<Valiant>
45  
46 =cut
« Valiant/Proxy.pm ↑ Summary Valiant/Validator/Boolean.pm »