Fluent/Elements/ArgumentList.pm

filter: Statementstmt 96.1% 25 / 26 Branchbran 75.0% 3 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 86.8% 33 / 38 CC 5 SCAR 10.6
CC
5
Cov
91%
to_variables
4.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.9
« Fluent/Elements/MessageReference.pm ↑ Summary Fluent/Elements/SelectExpression.pm »
1 package Translate::Fluent::Elements::ArgumentList;
2  
3 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 extends 'Translate::Fluent::Elements::Base';
5  
6 has argument => (
7 is => 'ro',
8 0 ▶ default => sub { [] },
Subroutine __ANON__: not called CC=1 SCAR=6.9
9 6 );
10  
11 16 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=7.0
12 16 my ($orig, $self, %args) = @_;
13  
14 16 $args{ argument } = delete $args{ Argument };
15 $args{ argument } = [ $args{ argument } ]
16 16 ▶ unless ref $args{argument} eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"argument"} eq "ARRAY" 0 16 16
17  
18 28 $args{ argument } = [map { {Argument => $_ } }
19 16 @{ $args{ argument } } ];
20  
21 16 $self->$orig( %args );
22 6 };
23  
24 9 ▶sub to_variables {
Subroutine to_variables: called CC=4 SCAR=13.9
Pod documented
25 9 my ($self, $variables ) = @_;
26  
27 9 my %vars;
28  
29 9 my $pos = 0;
30 9 ▶ for my $arg (@{ $self->argument // [] }) {
Condition50%1/2
$self->argument // []
l!l
90
MC/DC0%0/1
$self->argument // []
$self->argument
Truth table50%1/2
A
A= $self->argument
Aresult
11
00
31 15 my $id = $arg->identifier;
32 15 ▶ unless ($id ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($id) 3 12 15
33 3 $id = "position_$pos";
34 3 $pos++;
35 }
36 15 $vars{ $id } = $arg->translate( $variables );
37 }
38  
39 9 return \%vars;
40 }
41  
42  
43 6 1;
44  
45 __END__
« Fluent/Elements/MessageReference.pm ↑ Summary Fluent/Elements/SelectExpression.pm »