Factory/Result.pm

filter: Statementstmt 44.4% 28 / 63 Branchbran 25.0% 4 / 16 Conditioncond 11.1% 1 / 9 MC/DCmcdc 0.0% 0 / 6 Subroutinesub 35.7% 10 / 28 Podpod 100% 13 / 13 totaltotal 41.4% 56 / 135 CC 12 SCAR 14.2
CC
12
Cov
38%
__ANON__
12.0
__ANON__
12.0
__ANON__
6.0
CRAP 4.1
« Factory/Feature/Control/Length.pm ↑ Summary Factory/Control/Role/BooleanValue.pm »
1 package Form::Factory::Result;
2 1 $Form::Factory::Result::VERSION = '0.022';
3 1 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Form::Factory::Message;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 # ABSTRACT: Interface for the result classes
8  
9  
10 # requires qw(
11 # is_valid is_validated
12 # is_success is_outcome_known
13 # content
14 # messages
15 # );
16  
17 0 ▶sub is_failure {
Subroutine is_failure: not called CC=1 SCAR=6.9
Pod documented
18 0 my $self = shift;
19 0 return not $self->is_success;
20 }
21  
22  
23 23 ▶sub _return(&@) {
Subroutine _return: called CC=2 SCAR=6.9
24 23 my ($filter, @messages) = @_;
25
26 23 my @filtered = grep { $filter->() } @messages;
27 23 ▶ return wantarray ? @filtered : join "\n", map { $_->message } @filtered;
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 14 9 23
28 }
29  
30 0 ▶sub all_messages {
Subroutine all_messages: not called CC=1 SCAR=6.9
Pod documented
31 0 my $self = shift;
32 0 ▶ return _return { 1 } @{ $self->messages };
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 }
34  
35  
36 0 ▶sub info_messages {
Subroutine info_messages: not called CC=1 SCAR=6.9
Pod documented
37 0 my $self = shift;
38 0 ▶ return _return { $_->type eq 'info' } @{ $self->messages };
Subroutine __ANON__: not called CC=1 SCAR=6.9
39 }
40  
41  
42 0 ▶sub warning_messages {
Subroutine warning_messages: not called CC=1 SCAR=6.9
Pod documented
43 0 my $self = shift;
44 0 ▶ return _return { $_->type eq 'warning' } @{ $self->messages };
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 }
46  
47  
48 14 ▶sub error_messages {
Subroutine error_messages: called CC=1 SCAR=0.0
Pod documented
49 14 my $self = shift;
50 14 ▶ return _return { $_->type eq 'error' } @{ $self->messages };
Subroutine __ANON__: called CC=1 SCAR=0.0
51 }
52  
53  
54 0 ▶sub regular_messages {
Subroutine regular_messages: not called CC=1 SCAR=6.9
Pod documented
55 0 my $self = shift;
56 0 ▶ return _return { not $_->is_tied_to_field } @{ $self->messages };
Subroutine __ANON__: not called CC=1 SCAR=6.9
57 }
58  
59  
60 0 ▶sub regular_info_messages {
Subroutine regular_info_messages: not called CC=1 SCAR=6.9
Pod documented
61 0 my $self = shift;
62 0 ▶ return _return { not $_->is_tied_to_field and $_->type eq 'info' }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
not $_->is_tied_to_field and $_->type eq "info" 0 0 0
63 0 @{ $self->messages };
64 }
65  
66  
67 0 ▶sub regular_warning_messages {
Subroutine regular_warning_messages: not called CC=1 SCAR=6.9
Pod documented
68 0 my $self = shift;
69 0 ▶ return _return { not $_->is_tied_to_field and $_->type eq 'warning' }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
not $_->is_tied_to_field and $_->type eq "warning" 0 0 0
70 0 @{ $self->messages };
71 }
72  
73  
74 1 ▶sub regular_error_messages {
Subroutine regular_error_messages: called CC=1 SCAR=0.0
Pod documented
75 1 my $self = shift;
76 3 ▶ return _return { not $_->is_tied_to_field and $_->type eq 'error' }
Subroutine __ANON__: called CC=2 SCAR=7.6
Branch: 1 branch
BranchTrueFalseTotal
not $_->is_tied_to_field and $_->type eq "error" 3 0 3
77 1 @{ $self->messages };
78 }
79  
80  
81 1 ▶sub field_messages {
Subroutine field_messages: called CC=1 SCAR=1.2
Pod documented
82 1 my ($self, $field) = @_;
83 0 ▶ return _return { $_->is_tied_to_field and $_->field eq $field }
Subroutine __ANON__: not called CC=2 SCAR=17.9
Branch: 1 branch
BranchTrueFalseTotal
$_->is_tied_to_field and $_->field eq $field 0 0 0
84 1 @{ $self->messages };
85 }
86  
87  
88 0 ▶sub field_info_messages {
Subroutine field_info_messages: not called CC=1 SCAR=6.9
Pod documented
89 0 my ($self, $field) = @_;
90 0 ▶ return _return { $_->is_tied_to_field and $_->field eq $field and $_->type eq 'info'}
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
$_->is_tied_to_field and $_->field eq $field and $_->type eq "info" 0 0 0
Condition0%0/3
$_->is_tied_to_field and $_->field eq $field
!ll&&!rl&&r
000
MC/DC0%0/2
$_->is_tied_to_field and $_->field eq $field
$_->is_tied_to_field $_->field eq $field
Truth table0%0/3
A and B
A= $_->is_tied_to_fieldB= $_->field eq $field
ABresult
0X0
100
111
91 0 @{ $self->messages };
92 }
93  
94  
95 0 ▶sub field_warning_messages {
Subroutine field_warning_messages: not called CC=1 SCAR=6.9
Pod documented
96 0 my ($self, $field) = @_;
97 0 ▶ return _return { $_->is_tied_to_field and $_->field eq $field and $_->type eq 'warning'}
Subroutine __ANON__: not called CC=3 SCAR=24.8
Branch: 1 branch
BranchTrueFalseTotal
$_->is_tied_to_field and $_->field eq $field and $_->type eq "warning" 0 0 0
Condition0%0/3
$_->is_tied_to_field and $_->field eq $field
!ll&&!rl&&r
000
MC/DC0%0/2
$_->is_tied_to_field and $_->field eq $field
$_->is_tied_to_field $_->field eq $field
Truth table0%0/3
A and B
A= $_->is_tied_to_fieldB= $_->field eq $field
ABresult
0X0
100
111
98 0 @{ $self->messages };
99 }
100  
101  
102 7 ▶sub field_error_messages {
Subroutine field_error_messages: called CC=1 SCAR=0.4
Pod documented
103 7 my ($self, $field) = @_;
104 7 ▶ return _return { $_->is_tied_to_field and $_->field eq $field and $_->type eq 'error'}
Subroutine __ANON__: called CC=3 SCAR=14.2
Branch: 1 branch
BranchTrueFalseTotal
$_->is_tied_to_field and $_->field eq $field and $_->type eq "error" 7 0 7
Condition33%1/3
$_->is_tied_to_field and $_->field eq $field
!ll&&!rl&&r
007
MC/DC0%0/2
$_->is_tied_to_field and $_->field eq $field
$_->is_tied_to_field $_->field eq $field
Truth table33%1/3
A and B
A= $_->is_tied_to_fieldB= $_->field eq $field
ABresult
0X0
100
111
105 7 @{ $self->messages };
106 }
107  
108 1 1;
109  
110 __END__
« Factory/Feature/Control/Length.pm ↑ Summary Factory/Control/Role/BooleanValue.pm »