Syccess/ValidatorSimple.pm

filter: Statementstmt 88.2% 15 / 17 Branchbran 62.5% 5 / 8 Conditioncond 38.8% 7 / 18 MC/DCmcdc 11.1% 1 / 9 Subroutinesub 60.0% 3 / 5 Podpod 0.0% 0 / 4 totaltotal 50.8% 31 / 61 CC 11 SCAR 27.7
CC
11
Cov
63%
validate
21.1
undef_ok
2.0
empty_ok
2.0
CRAP 15.9
↑ Summary Syccess/Result.pm »
1 package Syccess::ValidatorSimple;
2 7 our $AUTHORITY = 'cpan:GETTY';
3 # ABSTRACT: Syccess validator
4 7 $Syccess::ValidatorSimple::VERSION = '0.104';
5 7 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 7 with qw(
8 Syccess::Validator
9 );
10  
11 7 requires qw(
12 validator
13 );
14  
15 31 ▶sub validate {
Subroutine validate: called CC=11 SCAR=30.5
Pod undocumented
16 31 my ( $self, %params ) = @_;
17 31 my $name = $self->syccess_field->name;
18 31 ▶ return if !exists($params{$name})
Branch: 1 branch
BranchTrueFalseTotal
if not exists $params{$name} and $self->missing_ok 3 28 31
Condition66%2/3
not exists $params{$name} and $self->missing_ok
!ll&&!rl&&r
2803
MC/DC50%1/2
not exists $params{$name} and $self->missing_ok
not exists $params{$name} $self->missing_ok
Truth table66%2/3
not(A) and B
A= not exists $params{$name}B= $self->missing_ok
ABresult
0X0
100
111
19 && $self->missing_ok;
20 return if exists($params{$name})
21 28 ▶ && !defined($params{$name})
Branch: 1 branch
BranchTrueFalseTotal
if exists $params{$name} and not defined $params{$name} and $self->undef_ok 0 28 28
Condition33%2/6
exists $params{$name} and not defined $params{$name} and $self->undef_ok
!ll&&!rl&&r
2800
exists $params{$name} and not defined $params{$name}
!ll&&!rl&&r
0280
MC/DC0%0/3
exists $params{$name} and not defined $params{$name} and $self->undef_ok
exists $params{$name} not defined $params{$name} $self->undef_ok
Truth table25%1/4
A and not(B) and C
A= exists $params{$name}B= not defined $params{$name}C= $self->undef_ok
ABCresult
0XX0
10X0
1100
1111
22 && $self->undef_ok;
23 return if exists($params{$name})
24 && defined($params{$name})
25 28 ▶ && $params{$name} eq ''
Branch: 1 branch
BranchTrueFalseTotal
if exists $params{$name} and defined $params{$name} and $params{$name} eq "" and $self->empty_ok 0 28 28
Condition33%3/9
exists $params{$name} and defined $params{$name} and $params{$name} eq "" and $self->empty_ok
!ll&&!rl&&r
2800
exists $params{$name} and defined $params{$name} and $params{$name} eq ""
!ll&&!rl&&r
0280
exists $params{$name} and defined $params{$name}
!ll&&!rl&&r
0028
MC/DC0%0/4
exists $params{$name} and defined $params{$name} and $params{$name} eq "" and $self->empty_ok
exists $params{$name} defined $params{$name} $params{$name} eq "" $self->empty_ok
Truth table20%1/5
A and B and C and D
A= exists $params{$name}B= defined $params{$name}C= $params{$name} eq ""D= $self->empty_ok
ABCDresult
0XXX0
10XX0
110X0
11100
11111
26 && $self->empty_ok;
27 return exists($params{$name})
28 28 ▶ ? $self->validator($params{$name})
Branch: 1 branch
BranchTrueFalseTotal
exists $params{$name} ? : 28 0 28
29 : $self->validator();
30 }
31  
32 3 ▶sub missing_ok { 1 }
Subroutine missing_ok: called CC=1 SCAR=0.0
Pod undocumented
33 0 ▶sub undef_ok { 1 }
Subroutine undef_ok: not called CC=1 SCAR=6.9
Pod undocumented
34 0 ▶sub empty_ok { 1 }
Subroutine empty_ok: not called CC=1 SCAR=6.9
Pod undocumented
35  
36 7 1;
37  
38 __END__
↑ Summary Syccess/Result.pm »