blib/lib/DTL/Fast/Filter/Ru/Pluralize.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 8 / 8 Conditioncond 100% 13 / 13 MC/DCmcdc 100% 8 / 8 Subroutinesub 100% 6 / 6 Podpod 0.0% 0 / 2 totaltotal 97.1% 69 / 71 SCAR 23.0
CC
10
Cov
100%
pluralize
9.0
parse_parameters
2.0
BEGIN
1.0
CRAP 10.0
« blib/lib/DTL/Fast/Filter/Timesince.pm ↑ Summary blib/lib/DTL/Fast/Replacer.pm »
1 package DTL::Fast::Filter::Ru::Pluralize;
2 1 ▶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 1 ▶use parent 'DTL::Fast::Filter::Pluralize';
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 $DTL::Fast::FILTER_HANDLERS{'pluralize'} = __PACKAGE__;
6  
7 #@Override
8 sub parse_parameters
9 {
10 11 ▶ my $self = shift;
Subroutine parse_parameters: called CC=2 SCAR=6.9
Pod undocumented
11 2 push @{$self->{'parameter'}}, DTL::Fast::Variable->new('""') # specify suffix for one, two and five
12 11 ▶ if not scalar @{$self->{'parameter'}};
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @{$self->{"parameter"};} 2 9 11
13 11 $self->{'suffix'} = $self->{'parameter'}->[0];
14 11 return $self;
15 }
16  
17 sub pluralize
18 {
19 11 ▶ my $self = shift;
Subroutine pluralize: called CC=9 SCAR=22.0
Pod undocumented
20 11 my $value = shift;
21 11 my $suffix = shift;
22
23 11 ▶ my $suffix_one = shift @$suffix // '';
Condition100%2/2
shift @$suffix // ""
l!l
92
MC/DC100%1/1
shift @$suffix // ""
shift @$suffix
Truth table100%2/2
A
A= shift @$suffix
Aresult
11
00
24 11 ▶ my $suffix_two = shift @$suffix // '';
Condition100%2/2
shift @$suffix // ""
l!l
92
MC/DC100%1/1
shift @$suffix // ""
shift @$suffix
Truth table100%2/2
A
A= shift @$suffix
Aresult
11
00
25 11 ▶ my $suffix_five = shift @$suffix // $suffix_two;
Condition100%3/3
shift @$suffix // $suffix_two
l!l&&r!l&&!r
722
MC/DC100%2/2
shift @$suffix // $suffix_two
shift @$suffix $suffix_two
Truth table100%3/3
A // B
A= shift @$suffixB= $suffix_two
ABresult
1X1
011
000
26
27 11 my $last_digit = substr int($value), -1;
28 11 my $amount = abs $value;
29
30 11 ▶ if( $amount >= 10 and $amount <= 20 ) {
Branch: 3 branches
BranchTrueFalseTotal
if ($amount >= 10 and $amount <= 20) { } 1 10 11
elsif ($last_digit == 1) { } 3 7 10
elsif ($last_digit >= 2 and $last_digit <= 4) { } 4 3 7
Condition100%3/3
$amount >= 10 and $amount <= 20
!ll&&!rl&&r
821
MC/DC100%2/2
$amount >= 10 and $amount <= 20
$amount >= 10 $amount <= 20
Truth table100%3/3
A and B
A= $amount >= 10B= $amount <= 20
ABresult
0X0
100
111
31 1 $value = $suffix_five;
32 }
33 elsif( $last_digit == 1 ) {
34 3 $value = $suffix_one;
35 }
36 ▶ elsif( $last_digit >= 2 and $last_digit <= 4 ) {
Condition100%3/3
$last_digit >= 2 and $last_digit <= 4
!ll&&!rl&&r
124
MC/DC100%2/2
$last_digit >= 2 and $last_digit <= 4
$last_digit >= 2 $last_digit <= 4
Truth table100%3/3
A and B
A= $last_digit >= 2B= $last_digit <= 4
ABresult
0X0
100
111
37 4 $value = $suffix_two;
38 }
39 else{
40 3 $value = $suffix_five;
41 }
42
43 11 return $value;
44
45 }
46  
47 1 1;
« blib/lib/DTL/Fast/Filter/Timesince.pm ↑ Summary blib/lib/DTL/Fast/Replacer.pm »