SyForm/ViewFieldRole/HTML.pm

filter: Statementstmt 96.7% 30 / 31 Branchbran 71.4% 10 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 10 / 10 Podpod 0.0% 0 / 1 totaltotal 89.2% 50 / 56 CC 8 SCAR 9.7
CC
8
Cov
89%
_build_syform_viewfield_labelhtml
4.4
_build_syform_viewfield_inputhtml
4.0
_build_syform_formhtml_children
2.1
CRAP 2.6
« SyForm/ViewRole/Bootstrap.pm ↑ Summary SyForm/FieldRole/Process.pm »
1 package SyForm::ViewFieldRole::HTML;
2 3 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 $SyForm::ViewFieldRole::HTML::AUTHORITY = 'cpan:GETTY';
4 }
5 # ABSTRACT:
6 3 $SyForm::ViewFieldRole::HTML::VERSION = '0.103';
7 3 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 3 ▶use SyForm::ViewField::InputHTML;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 3 ▶use SyForm::ViewField::LabelHTML;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 has html_name => (
12 is => 'lazy',
13 );
14  
15 13 ▶sub _build_html_name {
Subroutine _build_html_name: called CC=1 SCAR=0.0
16 13 my ( $self ) = @_;
17 13 return $self->field->name;
18 }
19  
20 3 has html_id => (
21 is => 'lazy',
22 );
23  
24 13 ▶sub _build_html_id {
Subroutine _build_html_id: called CC=1 SCAR=0.0
25 13 my ( $self ) = @_;
26 13 return $self->html_name;
27 }
28  
29 13 ▶sub has_syform_formhtml_children { 1 }
Subroutine has_syform_formhtml_children: called CC=1 SCAR=0.0
Pod undocumented
30  
31 3 has syform_formhtml_children => (
32 is => 'lazy',
33 );
34  
35 13 ▶sub _build_syform_formhtml_children {
Subroutine _build_syform_formhtml_children: called CC=2 SCAR=7.2
36 13 my ( $self ) = @_;
37 return [
38 13 ▶ $self->syform_viewfield_inputhtml,
Branch: 1 branch
BranchTrueFalseTotal
$self->has_label ? : 13 0 13
39 $self->has_label ? ( $self->syform_viewfield_labelhtml ) : (),
40 ];
41 }
42  
43 3 has syform_viewfield_inputhtml => (
44 is => 'lazy',
45 );
46  
47 13 ▶sub _build_syform_viewfield_inputhtml {
Subroutine _build_syform_viewfield_inputhtml: called CC=4 SCAR=13.9
48 13 my ( $self ) = @_;
49 return SyForm::ViewField::InputHTML->new(
50 type => 'text',
51 name => $self->html_name,
52 id => $self->html_id,
53 $self->has_label ? ( title => $self->label ) : (),
54 $self->has_val ? ( value => $self->val ) : (),
55 13 ▶ $self->field->has_input ? ( %{$self->field->input} ) : (),
Branch: 3 branches
BranchTrueFalseTotal
$self->has_label ? : 13 0 13
$self->has_val ? : 10 3 13
$self->field->has_input ? : 3 10 13
56 );
57 }
58  
59 3 has syform_viewfield_labelhtml => (
60 is => 'lazy',
61 );
62  
63 13 ▶sub _build_syform_viewfield_labelhtml {
Subroutine _build_syform_viewfield_labelhtml: called CC=4 SCAR=14.9
64 13 my ( $self ) = @_;
65 13 ▶ SyForm->throw('Require label for labelhtml') unless $self->has_label;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->has_label 0 13 13
66 return SyForm::ViewField::LabelHTML->new(
67 for => $self->html_id,
68 label => $self->label,
69 $self->is_invalid ? ( errors => $self->errors ) : (),
70 0 ▶ $self->field->has_html_label ? ( %{$self->field->html_label} ) : (),
Branch: 2 branches
BranchTrueFalseTotal
$self->is_invalid ? : 2 11 13
$self->field->has_html_label ? : 0 13 13
71 );
72 }
73  
74 3 1;
75  
76 __END__
« SyForm/ViewRole/Bootstrap.pm ↑ Summary SyForm/FieldRole/Process.pm »