blib/lib/DTL/Fast/Filter/Date.pm

filter: Statementstmt 75.8% 22 / 29 Branchbran 50.0% 1 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 85.7% 6 / 7 Podpod 0.0% 0 / 2 totaltotal 72.5% 29 / 40 SCAR 7.3
CC
2
Cov
74%
parse_parameters
2.1
filter
2.0
BEGIN
1.0
CRAP 2.1
« blib/lib/DTL/Fast/Tag/Load.pm ↑ Summary blib/lib/DTL/Fast/Filter/DefaultIfNone.pm »
1 package DTL::Fast::Filter::Date;
2 3 ▶use strict; use utf8; use warnings FATAL => 'all';
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use parent 'DTL::Fast::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 3 $DTL::Fast::FILTER_HANDLERS{'date'} = __PACKAGE__;
6  
7 3 ▶use DTL::Fast::Utils;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 #@Override
10 #@todo make pre-defined formats from Django
11 sub parse_parameters
12 {
13 3 ▶ my $self = shift;
Subroutine parse_parameters: called CC=2 SCAR=7.2
Pod undocumented
14 0 push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"DATE_FORMAT"')
15 3 ▶ if not scalar @{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"parameter"};} 0 3 3
16 3 $self->{'format'} = $self->{'parameter'}->[0];
17 3 return $self;
18 }
19  
20 #@Override
21 sub filter
22 {
23 0 ▶ my $self = shift; # self
Subroutine filter: not called CC=1 SCAR=6.9
Pod undocumented
24 0 shift; # filter_manager
25 0 my $value = shift;
26 0 my $context = shift;
27
28 0 my $format = $self->{'format'}->render($context);
29
30 0 return DTL::Fast::Utils::time2str_php($format, $value);
31 }
32  
33 3 1;
« blib/lib/DTL/Fast/Tag/Load.pm ↑ Summary blib/lib/DTL/Fast/Filter/DefaultIfNone.pm »