Catmandu/Validator/Simple.pm

filter: Statementstmt 100% 19 / 19 Branchbran 100% 4 / 4 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 1 totaltotal 91.1% 31 / 34 CC 4 SCAR 6.9
CC
4
Cov
96%
validate_data
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 2.0
« Catmandu/Plugin/Readonly/Searchable.pm ↑ Summary Catmandu/Fix/Parser.pm »
1 package Catmandu::Validator::Simple;
2  
3 3 ▶use Catmandu::Sane;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 our $VERSION = '1.2025';
6  
7 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 3 with 'Catmandu::Validator';
11  
12 has handler => (
13 is => 'rw',
14 required => 1,
15 7 ▶ isa => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
16 7 ▶ Catmandu::BadArg->throw("handler should be a CODE reference")
Branch: 1 branch
BranchTrueFalseTotal
unless ref $_[0] eq "CODE" 1 6 7
17 unless ref $_[0] eq 'CODE';
18 },
19 3 );
20  
21 7 ▶sub validate_data {
Subroutine validate_data: called CC=3 SCAR=11.0
Pod undocumented
22 7 my ($self, $data) = @_;
23  
24 7 my $error_messages = &{$self->handler}($data);
25 7 ▶ $error_messages = [$error_messages]
Branch: 1 branch
BranchTrueFalseTotal
unless not $error_messages or ref $error_messages eq "ARRAY" 4 3 7
Condition66%2/3
not $error_messages or ref $error_messages eq "ARRAY"
l!l&&r!l&&!r
304
MC/DC50%1/2
not $error_messages or ref $error_messages eq "ARRAY"
not $error_messages ref $error_messages eq "ARRAY"
Truth table66%2/3
not(A) or B
A= not $error_messagesB= ref $error_messages eq "ARRAY"
ABresult
1X1
011
000
26 unless !$error_messages || ref $error_messages eq 'ARRAY';
27 7 return $error_messages;
28 }
29  
30 3 1;
31  
32 __END__
« Catmandu/Plugin/Readonly/Searchable.pm ↑ Summary Catmandu/Fix/Parser.pm »