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

filter: Statementstmt 100% 26 / 26 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 95.0% 38 / 40 SCAR 13.9
CC
4
Cov
100%
filter
3.0
parse_parameters
2.0
BEGIN
1.0
CRAP 4.0
« blib/lib/DTL/Fast/Text.pm ↑ Summary blib/lib/DTL/Fast/Filter/Filesizeformat.pm »
1 package DTL::Fast::Filter::Yesno;
2 2 ▶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 2 ▶use parent 'DTL::Fast::Filter';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 2 $DTL::Fast::FILTER_HANDLERS{'yesno'} = __PACKAGE__;
6  
7 #@Override
8 sub parse_parameters
9 {
10 10 ▶ my $self = shift;
Subroutine parse_parameters: called CC=2 SCAR=6.9
Pod undocumented
11 5 push @{$self->{'parameter'}}, DTL::Fast::Variable->new('"yes,no,maybe"')
12 10 ▶ if not scalar @{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"parameter"};} 5 5 10
13 10 $self->{'mappings'} = $self->{'parameter'}->[0];
14 10 return $self;
15 }
16  
17  
18 #@Override
19 sub filter
20 {
21 10 ▶ my $self = shift; # self
Subroutine filter: called CC=3 SCAR=11.0
Pod undocumented
22 10 shift; # filter_manager
23 10 my $value = shift;
24 10 my $context = shift; # context
25  
26 10 my @mappings = split /\s*,\s*/s, $self->{'mappings'}->render($context);
27
28 10 ▶ return $value ?
Branch: 2 branches
BranchTrueFalseTotal
$value ? : 4 6 10
defined $value ? : 4 2 6
29 $mappings[0]
30 : defined $value ?
31 $mappings[1]
32 : $mappings[2];
33 }
34  
35 2 1;
« blib/lib/DTL/Fast/Text.pm ↑ Summary blib/lib/DTL/Fast/Filter/Filesizeformat.pm »