SyForm/ViewField.pm

filter: Statementstmt 86.9% 20 / 23 Branchbran 50.0% 4 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 0.0% 0 / 2 totaltotal 73.6% 28 / 38 CC 5 SCAR 11.6
CC
5
Cov
77%
val
5.2
has_val
3.0
_build_has_name
2.0
CRAP 3.2
« SyForm/ViewField/LabelHTML.pm ↑ Summary SyForm/Util/HTML.pm »
1 package SyForm::ViewField;
2 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 $SyForm::ViewField::AUTHORITY = 'cpan:GETTY';
4 }
5 # ABSTRACT: View fields inside a SyForm::View
6 3 $SyForm::ViewField::VERSION = '0.103';
7 3 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 3 with qw(
10 MooX::Traits
11 SyForm::ViewFieldRole::Verify
12 SyForm::ViewFieldRole::HTML
13 SyForm::ViewFieldRole::Bootstrap
14 );
15  
16 3 has field => (
17 is => 'ro',
18 predicate => 1,
19 );
20  
21 3 has view => (
22 is => 'ro',
23 required => 1,
24 handles => [qw(
25 viewfields
26 fields
27 syform
28 results
29 values
30 )],
31 );
32  
33 3 has name => (
34 is => 'ro',
35 required => 1,
36 );
37  
38 3 has has_name => (
39 is => 'lazy',
40 );
41 0 ▶sub _build_has_name { 'has_'.($_[0]->name) }
Subroutine _build_has_name: not called CC=1 SCAR=6.9
42  
43 3 has label => (
44 is => 'ro',
45 predicate => 1,
46 );
47  
48 3 has value => (
49 is => 'ro',
50 predicate => 1,
51 );
52  
53 3 has result => (
54 is => 'ro',
55 predicate => 1,
56 );
57  
58 10 ▶sub val {
Subroutine val: called CC=3 SCAR=16.5
Pod undocumented
59 10 my ( $self ) = @_;
60 10 ▶ return $self->result if $self->has_result;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_result 10 0 10
61 0 ▶ return $self->value if $self->has_value;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_value 0 0 0
62 0 return;
63 }
64  
65 13 ▶sub has_val {
Subroutine has_val: called CC=3 SCAR=11.0
Pod undocumented
66 13 my ( $self ) = @_;
67 13 ▶ return 1 if $self->has_result;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_result 10 3 13
68 3 ▶ return 1 if $self->has_value;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_value 0 3 3
69 3 return 0;
70 }
71  
72 3 1;
73  
74 __END__
« SyForm/ViewField/LabelHTML.pm ↑ Summary SyForm/Util/HTML.pm »