TreeValidator/RepeatingBranch.pm

filter: Statementstmt 100% 34 / 34 Branchbran n/a Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 8 / 8 Podpod 100% 1 / 1 totaltotal 93.7% 45 / 48 CC 2 SCAR 2.0
CC
2
Cov
97%
process
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« TreeValidator/Result/Branch.pm ↑ Summary TreeValidator/Sugar.pm »
1 package Data::TreeValidator::RepeatingBranch;
2 {
3 4 $Data::TreeValidator::RepeatingBranch::VERSION = '0.04';
4 }
5 # ABSTRACT: A branch that can have its input repeated multiple times
6 4 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 4 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 4 ▶use Data::TreeValidator::Types qw( HashTree );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 4 ▶use aliased 'Data::TreeValidator::Result::Branch' => 'Result';
Subroutine BEGIN: called CC=1 SCAR=0.0
12 4 ▶use aliased 'Data::TreeValidator::Result::Repeating' => 'RepeatingResult';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 4 ▶use MooseX::Params::Validate;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 4 ▶use MooseX::Types::Moose qw( ArrayRef Maybe );
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 4 with 'Data::TreeValidator::Node';
18 4 extends 'Data::TreeValidator::Branch';
19  
20 3 ▶sub process {
Subroutine process: called CC=2 SCAR=6.9
Pod documented
21 3 my $self = shift;
22 3 my ($tree) = pos_validated_list([ shift ],
23 { isa => Maybe[ ArrayRef[HashTree] ], coerce => 1 }
24 );
25 3 my %args = @_;
26  
27 3 ▶ my $process = $tree || $args{initialize};
Condition66%2/3
$tree || $args{'initialize'}
l!l&&r!l&&!r
210
MC/DC0%0/2
$tree || $args{'initialize'}
$tree $args{'initialize'}
Truth table66%2/3
A || B
A= $treeB= $args{'initialize'}
ABresult
1X1
011
000
28  
29 return RepeatingResult->new(
30 input => $tree,
31 results => [
32 map {
33 3 my $element = $_;
34 Result->new(
35 input => $element,
36 results => {
37 map {
38 5 $_ => $self->child($_)->process($element->{$_})
39 } $self->child_names
40 }
41 )
42 } @$process
43 ]
44 );
45 }
46  
47 4 1;
48  
49  
50  
51 __END__
« TreeValidator/Result/Branch.pm ↑ Summary TreeValidator/Sugar.pm »