lib/HTML/FormFu/Constraint/AutoSet.pm

filter: Statementstmt 100% 23 / 23 Branchbran 75.0% 3 / 4 Conditioncond 33.3% 1 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 100% 4 / 4 Podpod 0.0% 0 / 1 totaltotal 83.7% 31 / 37 CC 4 SCAR 10.3
CC
4
Cov
90%
_parse_value
4.2
BEGIN
1.0
BEGIN
1.0
CRAP 2.8
« lib/HTML/FormFu/Role/ContainsElements.pm ↑ Summary lib/HTML/FormFu/Constraint/Set.pm »
1 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2  
3 package HTML::FormFu::Constraint::AutoSet;
4 6 $HTML::FormFu::Constraint::AutoSet::VERSION = '2.09';
5 # ABSTRACT: Set Constraint for Selects / Radiogroups / Checkboxgroups
6  
7 6 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 extends 'HTML::FormFu::Constraint::Set';
9  
10 9 ▶sub process {
Subroutine process: called CC=1 SCAR=0.0
Pod undocumented
11 9 my $self = shift;
12  
13 9 my @set = map { _parse_value($_) } @{ $self->parent->_options };
14  
15 9 $self->set( \@set );
16  
17 9 return $self->SUPER::process(@_);
18 }
19  
20 27 ▶sub _parse_value {
Subroutine _parse_value: called CC=4 SCAR=14.2
21 27 my ($item) = @_;
22  
23 27 ▶ if ( exists $item->{group} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $item->{'group'}) { } 2 25 27
24 2 return map { _parse_value($_) } @{ $item->{group} };
25 }
26 else {
27 # disabled attributes should be ignored
28 25 ▶ return if ( $item->{attributes} and $item->{attributes}->{disabled} );
Branch: 1 branch
BranchTrueFalseTotal
if $item->{"attributes"} and $item->{"attributes"}{"disabled"} 0 25 25
Condition33%1/3
$item->{"attributes"} and $item->{"attributes"}{"disabled"}
!ll&&!rl&&r
0250
MC/DC0%0/2
$item->{"attributes"} and $item->{"attributes"}{"disabled"}
$item->{"attributes"} $item->{"attributes"}{"disabled"}
Truth table33%1/3
A and B
A= $item->{"attributes"}B= $item->{"attributes"}{"disabled"}
ABresult
0X0
100
111
29  
30 # anything else is fine
31 25 return $item->{value};
32 }
33 }
34  
35 6 __PACKAGE__->meta->make_immutable;
36  
37 6 1;
38  
39 __END__
« lib/HTML/FormFu/Role/ContainsElements.pm ↑ Summary lib/HTML/FormFu/Constraint/Set.pm »