Valiemon/Attributes/Type.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 4 / 4 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 2 totaltotal 96.0% 48 / 50 CC 4 SCAR 4.8
CC
4
Cov
100%
_check
3.0
__ANON__
2.0
BEGIN
1.0
CRAP 1.6
« Valiemon/Attributes/Format.pm ↑ Summary Valiemon/Context.pm »
1 package Valiemon::Attributes::Type;
2 18 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 18 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 18 ▶use utf8;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 18 ▶use parent qw(Valiemon::Attributes);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 18 ▶use List::MoreUtils qw(any);
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 446 ▶sub attr_name { 'type' }
Subroutine attr_name: called CC=1 SCAR=0.0
Pod undocumented
10  
11 446 ▶sub is_valid {
Subroutine is_valid: called CC=1 SCAR=0.0
Pod undocumented
12 446 my ($class, $context, $schema, $data) = @_;
13 446 ▶ $context->in_attr($class, sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
14 446 my $types = $schema->{type};
15  
16 446 my $is_valid = do {
17 446 ▶ if (ref $types eq 'ARRAY') {
Branch: 1 branch
BranchTrueFalseTotal
if (ref $types eq 'ARRAY') { } 30 416 446
18 30 ▶ any { $class->_check($context->prims, $_, $data) } @$types
Subroutine __ANON__: called CC=1 SCAR=0.0
19 } else {
20 416 $class->_check($context->prims, $types, $data);
21 }
22 };
23 446 $is_valid;
24 446 });
25 }
26  
27 471 ▶sub _check {
Subroutine _check: called CC=3 SCAR=11.0
28 471 my ($class, $prims, $type, $data) = @_;
29 471 my $method = 'is_' . $type;
30 471 ▶ $prims->can($method) && $prims->$method($data) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$prims->can($method) && $prims->$method($data) ? : 292 179 471
Condition100%3/3
$prims->can($method) and $prims->$method($data)
!ll&&!rl&&r
21158292
MC/DC100%2/2
$prims->can($method) and $prims->$method($data)
$prims->can($method) $prims->$method($data)
Truth table100%3/3
A and B
A= $prims->can($method)B= $prims->$method($data)
ABresult
0X0
100
111
31 }
32  
33 18 1;
« Valiemon/Attributes/Format.pm ↑ Summary Valiemon/Context.pm »