lib/Template/Mustache/Token/Template.pm

filter: Statementstmt 100% 24 / 24 Branchbran 87.5% 7 / 8 Conditioncond 55.5% 5 / 9 MC/DCmcdc 20.0% 1 / 5 Subroutinesub 100% 5 / 5 Podpod 0.0% 0 / 2 totaltotal 79.2% 42 / 53 SCAR 20.9
CC
8
Cov
88%
render
7.2
flatten
2.0
BEGIN
1.0
CRAP 8.1
« lib/Template/Mustache.pm ↑ Summary lib/Template/Mustache/Token/Section.pm »
1 package Template::Mustache::Token::Template;
2 23 our $AUTHORITY = 'cpan:YANICK';
3 # ABSTRACT: Object representing a Template block
4 23 $Template::Mustache::Token::Template::VERSION = '1.3.3';
5 23 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 23 ▶use MooseX::MungeHas { has_ro => [ 'is_ro' ] };
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 23 has_ro 'items';
10  
11 has escape => (
12 is => 'rw',
13 59 ▶ lazy => 1, default => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
14 23 predicate => 1,
15 );
16  
17 sub flatten {
18 165 ▶ return map { ref $_ eq 'ARRAY' ? flatten(@$_) : $_ } grep { ref } @_;
Subroutine flatten: called CC=2 SCAR=7.1
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
ref $_ eq 'ARRAY' ? : 0 490 490
19 }
20  
21 sub render {
22 165 ▶ my( $self, $context, $partials, $indent ) = @_;
Subroutine render: called CC=7 SCAR=19.8
Pod undocumented
23  
24 490 ▶ my @nodes = grep { ref $_ ne 'Template::Mustache::Token::Verbatim' or
Branch: 1 branch
BranchTrueFalseTotal
ref $_ ne "Template::Mustache::Token::Verbatim" or length $_->content 310 180 490
25 165 length $_->content } flatten( @{ $self->items } );
26  
27 $_->can('has_escape') and ( $_->has_escape or $_->escape($self->escape) )
28 165 ▶ for @nodes;
Branch: 1 branch
BranchTrueFalseTotal
$_->can("has_escape") and $_->has_escape || $_->escape($self->escape) 153 172 325
Condition50%3/6
$_->can('has_escape') && ($_->has_escape || $_->escape($self->escape))
!ll&&!rl&&r
1721530
$_->has_escape or $_->escape($self->escape)
l!l&&r!l&&!r
01530
MC/DC0%0/3
$_->can('has_escape') && ($_->has_escape || $_->escape($self->escape))
$_->can('has_escape') $_->has_escape $_->escape($self->escape)
Truth table0%0/4
A && B or C
A= $_->can('has_escape')B= $_->has_escapeC= $_->escape($self->escape)
ABCresult
0XX0
1000
11X1
1011
29  
30 165 ▶ if( @nodes and ref $nodes[-1] eq 'Template::Mustache::Token::Verbatim' ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@nodes and ref $nodes[-1] eq "Template::Mustache::Token::Verbatim") 38 127 165
Condition66%2/3
@nodes and ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
!ll&&!rl&&r
012738
MC/DC50%1/2
@nodes and ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
@nodes ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
Truth table66%2/3
A and B
A= @nodesB= ref $nodes[-1] eq "Template::Mustache::Token::Verbatim"
ABresult
0X0
100
111
31 38 $nodes[-1]->last(1);
32 }
33  
34 165 return join '', map { $_->render($context, $partials, $indent ) } @nodes;
35 }
36  
37 23 1;
38  
39 __END__
40  
41 =pod
42  
43 =encoding UTF-8
44  
45 =head1 NAME
46  
47 Template::Mustache::Token::Template - Object representing a Template block
48  
49 =head1 VERSION
50  
51 version 1.3.3
52  
53 =head1 AUTHORS
54  
55 =over 4
56  
57 =item *
58  
59 Pieter van de Bruggen <pvande@cpan.org>
60  
61 =item *
62  
63 Yanick Champoux <yanick@cpan.org>
64  
65 =item *
66  
67 Ricardo Signes <rjbs@cpan.org>
68  
69 =back
70  
71 =head1 COPYRIGHT AND LICENSE
72  
73 This software is copyright (c) 2019, 2018, 2017, 2016, 2015, 2011 by Pieter van de Bruggen.
74  
75 This is free software; you can redistribute it and/or modify it under
76 the same terms as the Perl 5 programming language system itself.
77  
78 =cut
« lib/Template/Mustache.pm ↑ Summary lib/Template/Mustache/Token/Section.pm »