SyForm/ViewFieldRole/Verify.pm

filter: Statementstmt 100% 17 / 17 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 96.4% 27 / 28 CC 4 SCAR 5.7
CC
4
Cov
96%
_build_errors
2.1
_build_is_invalid
2.0
_build_is_valid
2.0
CRAP 1.8
« SyForm/ViewRole/HTML.pm ↑ Summary SyForm/View.pm »
1 package SyForm::ViewFieldRole::Verify;
2 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 $SyForm::ViewFieldRole::Verify::AUTHORITY = 'cpan:GETTY';
4 }
5 # ABSTRACT: Trait for SyForm fields of SyForm::Results and SyForm::Values attributes
6 3 $SyForm::ViewFieldRole::Verify::VERSION = '0.103';
7 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 has is_invalid => (
10 is => 'lazy',
11 );
12  
13 13 ▶sub _build_is_invalid {
Subroutine _build_is_invalid: called CC=2 SCAR=6.9
14 13 my ( $self ) = @_;
15 13 ▶ return $self->is_valid ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_valid ? : 11 2 13
16 }
17  
18 3 has is_valid => (
19 is => 'lazy',
20 );
21  
22 13 ▶sub _build_is_valid {
Subroutine _build_is_valid: called CC=2 SCAR=6.9
23 13 my ( $self ) = @_;
24 13 my @errors = @{$self->errors};
25 13 ▶ return scalar @errors > 0 ? 0 : 1;
Branch: 1 branch
BranchTrueFalseTotal
scalar @errors > 0 ? : 2 11 13
26 }
27  
28 3 has errors => (
29 is => 'lazy',
30 );
31  
32 13 ▶sub _build_errors {
Subroutine _build_errors: called CC=2 SCAR=7.2
33 13 my ( $self ) = @_;
34 13 ▶ return $self->results->does('SyForm::ResultsRole::Success')
Branch: 1 branch
BranchTrueFalseTotal
$self->results->does('SyForm::ResultsRole::Success') ? : 13 0 13
35 ? $self->results->syccess_result->errors($self->name) : [];
36 }
37  
38 # sub has_original_value {
39 # my ( $self ) = @_;
40 # return $self->has_value;
41 # }
42  
43 # sub original_value {
44 # my ( $self ) = @_;
45 # return $self->results->verify_results->get_original_value($self->name);
46 # }
47  
48 3 1;
49  
50 __END__
« SyForm/ViewRole/HTML.pm ↑ Summary SyForm/View.pm »