FormValidator/Role/Validator.pm

filter: Statementstmt 100% 24 / 24 Branchbran 100% 2 / 2 Conditioncond 83.3% 5 / 6 MC/DCmcdc 66.6% 2 / 3 Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 93.0% 40 / 43 CC 4 SCAR 7.9
CC
4
Cov
97%
_field_defined_and_non_empty
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.2
« FormValidator/Validator/AlphaNum.pm ↑ Summary FormValidator/Config.pm »
1 package Dancer2::Plugin::FormValidator::Role::Validator;
2  
3 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 18 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 18 ▶use Types::Standard qw(ConsumerOf);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 18 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 18 has extension => (
11 is => 'ro',
12 isa => ConsumerOf['Dancer2::Plugin::FormValidator::Role::Extension'],
13 predicate => 1,
14 );
15  
16 18 requires 'validate';
17 18 requires 'message';
18  
19 sub stop_on_fail {
20 29 ▶ return 0;
Subroutine stop_on_fail: called CC=1 SCAR=0.0
Pod undocumented
21 }
22  
23 sub _field_defined_and_non_empty {
24 106 ▶ my ($self, $field, $input) = @_;
Subroutine _field_defined_and_non_empty: called CC=4 SCAR=13.9
25  
26 106 ▶ if (
Branch: 1 branch
BranchTrueFalseTotal
if (exists $input->{$field} and defined $input->{$field} and $input->{$field} ne "") 94 12 106
Condition83%5/6
exists $input->{$field} and defined $input->{$field} and $input->{$field} ne ""
!ll&&!rl&&r
10294
exists $input->{$field} and defined $input->{$field}
!ll&&!rl&&r
10096
MC/DC66%2/3
exists $input->{$field} and defined $input->{$field} and $input->{$field} ne ""
exists $input->{$field} defined $input->{$field} $input->{$field} ne ""
Truth table75%3/4
A and B and C
A= exists $input->{$field}B= defined $input->{$field}C= $input->{$field} ne ""
ABCresult
0XX0
10X0
1100
1111
27 exists $input->{$field}
28 and defined $input->{$field}
29 and $input->{$field} ne ''
30 ) {
31 94 return 1;
32 }
33  
34 12 return 0;
35 }
36  
37 18 1;
« FormValidator/Validator/AlphaNum.pm ↑ Summary FormValidator/Config.pm »