Shakan/Renderer/HTML.pm

filter: Statementstmt 62.9% 17 / 27 Branchbran 0.0% 0 / 6 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 83.3% 5 / 6 Podpod 0.0% 0 / 1 totaltotal 48.8% 22 / 45 CC 6 SCAR 31.5
CC
6
Cov
47%
render
42.0
BEGIN
1.0
BEGIN
1.0
CRAP 23.4
« Shakan/Widgets/Simple.pm ↑ Summary Shakan.pm »
1 package HTML::Shakan::Renderer::HTML;
2 22 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 22 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 22 ▶use Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 22 ▶use HTML::Escape ();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 22 has 'id_tmpl' => (
8 is => 'ro',
9 isa => 'Str',
10 default => 'id_%s',
11 );
12  
13 0 ▶sub render {
Subroutine render: not called CC=6 SCAR=37.4
Pod undocumented
14 0 my ($self, $form) = @_;
15  
16 0 my @res;
17 0 for my $field ($form->fields) {
18 0 ▶ unless ($field->id) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($field->id) 0 0 0
19 0 $field->id(sprintf($self->id_tmpl(), $field->{name}));
20 }
21 0 ▶ if ($field->label) {
Branch: 1 branch
BranchTrueFalseTotal
if ($field->label) 0 0 0
22 0 ▶ my $label_css = ($field->has_label_class() && $field->label_class ne '')
Branch: 1 branch
BranchTrueFalseTotal
$field->has_label_class && $field->label_class ne '' ? : 0 0 0
Condition0%0/3
$field->has_label_class and $field->label_class ne ""
!ll&&!rl&&r
000
MC/DC0%0/2
$field->has_label_class and $field->label_class ne ""
$field->has_label_class $field->label_class ne ""
Truth table0%0/3
A and B
A= $field->has_label_classB= $field->label_class ne ""
ABresult
0X0
100
111
23 ? sprintf(q{ class="%s"}, $field->label_class)
24 : '';
25 push @res, sprintf( q{<label%s for="%s">%s</label>},
26 0 $label_css, $field->{id}, HTML::Escape::escape_html( $field->{label} ) );
27 }
28 0 push @res, $form->widgets->render( $form, $field );
29 }
30 0 join '', @res;
31 }
32  
33 22 ▶no Mouse;
Subroutine BEGIN: called CC=1 SCAR=0.0
34 22 __PACKAGE__->meta->make_immutable;
35 __END__
« Shakan/Widgets/Simple.pm ↑ Summary Shakan.pm »