SyForm/FieldRole/Default.pm

filter: Statementstmt 100% 16 / 16 Branchbran 100% 6 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 93.5% 29 / 31 CC 5 SCAR 9.2
CC
5
Cov
96%
__ANON__
3.0
__ANON__
3.0
BEGIN
1.0
CRAP 2.5
« SyForm/Values.pm ↑ Summary SyForm/Results.pm »
1 package SyForm::FieldRole::Default;
2 6 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 6 $SyForm::FieldRole::Default::AUTHORITY = 'cpan:GETTY';
4 }
5 # ABSTRACT: A default for the field
6 6 $SyForm::FieldRole::Default::VERSION = '0.103';
7 6 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 6 has default => (
10 is => 'ro',
11 predicate => 1,
12 );
13  
14 38 ▶around has_value_by_args => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
15 38 my ( $orig, $self, %args ) = @_;
16 38 ▶ return 1 if $self->$orig(%args);
Branch: 1 branch
BranchTrueFalseTotal
if $self->$orig(%args) 13 25 38
17 25 ▶ return 1 if $self->has_default;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_default 7 18 25
18 18 return 0;
19 6 };
20  
21 20 ▶around get_value_by_process_args => sub {
Subroutine __ANON__: called CC=3 SCAR=11.0
22 20 my ( $orig, $self, %args ) = @_;
23 20 ▶ return $self->default if !exists($args{$self->name}) && $self->has_default;
Branch: 1 branch
BranchTrueFalseTotal
if not exists $args{$self->name} and $self->has_default 7 13 20
Condition66%2/3
not exists $args{$self->name} and $self->has_default
!ll&&!rl&&r
1307
MC/DC50%1/2
not exists $args{$self->name} and $self->has_default
not exists $args{$self->name} $self->has_default
Truth table66%2/3
not(A) and B
A= not exists $args{$self->name}B= $self->has_default
ABresult
0X0
100
111
24 13 return $self->$orig(%args);
25 6 };
26  
27 6 1;
28  
29 __END__
« SyForm/Values.pm ↑ Summary SyForm/Results.pm »