| 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
| |||||||||||
| 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
| |||||||||||
| 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
| |||||||||||
| 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__ | ||||||||||