FormValidator/Validator/Boolean.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 0.0% 0 / 2 totaltotal 89.7% 35 / 39 CC 2 SCAR 2.0
CC
2
Cov
93%
validate
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« FormValidator/Validator/Numeric.pm ↑ Summary FormValidator/Validator/Accepted.pm »
1 package Dancer2::Plugin::FormValidator::Validator::Boolean;
2  
3 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 2 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 2 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use List::Util qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 2 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 2 with 'Dancer2::Plugin::FormValidator::Role::Validator';
12  
13 sub message {
14 return {
15 1 ▶ en => '%s must be boolean',
Subroutine message: called CC=1 SCAR=0.0
Pod undocumented
16 ru => '%s должно иметь логическое значение',
17 de => '%s muss boolesch sein',
18 };
19 }
20  
21 sub validate {
22 2 ▶ my ($self, $field, $input) = @_;
Subroutine validate: called CC=2 SCAR=7.4
Pod undocumented
23  
24 2 ▶ if ($self->_field_defined_and_non_empty($field, $input)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_field_defined_and_non_empty($field, $input)) 2 0 2
25 2 ▶ return any { $input->{$field} eq $_ } qw(0 1);
Subroutine __ANON__: called CC=1 SCAR=0.0
26 }
27  
28 0 return 1;
29 }
30  
31 2 1;
« FormValidator/Validator/Numeric.pm ↑ Summary FormValidator/Validator/Accepted.pm »