FormValidator/Validator/Accepted.pm

filter: Statementstmt 96.4% 27 / 28 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 2 totaltotal 90.4% 38 / 42 CC 2 SCAR 1.8
CC
2
Cov
93%
validate
2.1
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« FormValidator/Validator/Boolean.pm ↑ Summary FormValidator/Input.pm »
1 package Dancer2::Plugin::FormValidator::Validator::Accepted;
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 accepted',
Subroutine message: called CC=1 SCAR=0.0
Pod undocumented
16 ru => '%s должно быть выбрано',
17 de => '%s muss markiert sein',
18 };
19 }
20  
21 around 'stop_on_fail' => sub {
22 1 ▶ return 1;
Subroutine __ANON__: called CC=1 SCAR=0.0
23 2 };
24  
25 sub validate {
26 5 ▶ my ($self, $field, $input) = @_;
Subroutine validate: called CC=2 SCAR=7.4
Pod undocumented
27  
28 5 ▶ if (exists $input->{$field}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $input->{$field}) 5 0 5
29 5 ▶ return any { $input->{$field} eq $_ } qw(yes on 1);
Subroutine __ANON__: called CC=1 SCAR=0.0
30 }
31  
32 0 return 0;
33 }
34  
35 2 1;
« FormValidator/Validator/Boolean.pm ↑ Summary FormValidator/Input.pm »