Spoon/Template.pm

filter: Statementstmt 70.4% 31 / 44 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 70.0% 7 / 10 Podpod 16.6% 1 / 6 totaltotal 60.9% 39 / 64 CC 5 SCAR 11.9
CC
5
Cov
65%
all
6.0
append_path
6.0
process
6.0
CRAP 3.3
« Spoon/Formatter.pm ↑ Summary Spoon/Plugin.pm »
1 package Spoon::Template;
2 3 ▶use Spoon::Base -Base;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use Template;
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 const class_id => 'template';
6 3 const template_path => [ './template' ];
7 3 field path => [];
8 3 stub 'render';
9 3 field config => -init => '$self->hub->config';
10 3 field cgi => -init => '$self->hub->cgi';
11  
12 1 ▶sub init {
Subroutine init: called CC=1 SCAR=0.0
Pod documented
13 1 $self->add_path(@{$self->template_path});
14 }
15  
16 0 ▶sub all {
Subroutine all: not called CC=2 SCAR=17.9
Pod undocumented
17 return (
18 0 ▶ $self->config->all,
Branch: 1 branch
BranchTrueFalseTotal
$self->is_in_cgi ? : 0 0 0
19 $self->is_in_cgi ? ($self->cgi->all) : (),
20 hub => $self->hub,
21 );
22 }
23  
24 1 ▶sub add_path {
Subroutine add_path: called CC=2 SCAR=6.9
Pod undocumented
25 1 for (reverse @_) {
26 1 $self->remove_path($_);
27 1 unshift @{$self->path}, $_;
28 }
29 }
30  
31 0 ▶sub append_path {
Subroutine append_path: not called CC=2 SCAR=17.9
Pod undocumented
32 0 for (@_) {
33 0 $self->remove_path($_);
34 0 push @{$self->path}, $_;
35 }
36 }
37  
38 1 ▶sub remove_path {
Subroutine remove_path: called CC=1 SCAR=0.1
Pod undocumented
39 1 my $path = shift;
40 0 $self->path([grep {$_ ne $path} @{$self->path}]);
41 }
42  
43 0 ▶sub process {
Subroutine process: not called CC=2 SCAR=17.9
Pod undocumented
44 0 my $template = shift;
45 0 ▶ my @templates = (ref $template eq 'ARRAY')
Branch: 1 branch
BranchTrueFalseTotal
ref $template eq 'ARRAY' ? : 0 0 0
46 ? @$template
47 : $template;
48 return join '', map {
49 0 $self->render($_, $self->all, @_)
50 } @templates;
51 }
52  
53 3 __END__
« Spoon/Formatter.pm ↑ Summary Spoon/Plugin.pm »