Fluent/Elements/Message.pm

filter: Statementstmt 91.6% 22 / 24 Branchbran 100% 4 / 4 Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 80.0% 4 / 5 Podpod 100% 2 / 2 totaltotal 86.8% 33 / 38 CC 5 SCAR 10.1
CC
5
Cov
90%
get_attribute_resource
4.2
__ANON__
2.0
__ANON__
2.0
CRAP 2.7
« Fluent/Elements/SelectExpression.pm ↑ Summary Fluent/Elements/InlinePlaceable.pm »
1 package Translate::Fluent::Elements::Message;
2  
3 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 extends 'Translate::Fluent::Elements::Base';
5  
6 has [qw(identifier pattern attributes)] => (
7 is => 'ro',
8 0 ▶ default => sub { undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
9 6 );
10  
11 62 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
12 62 my ($orig, $class, %args) = @_;
13  
14 62 $args{ identifier } = delete $args{ Identifier };
15 62 $args{ pattern } = delete $args{ Pattern };
16 62 $args{ attributes } = delete $args{ Attribute };
17 $args{ attributes } = [ $args{ attributes } ]
18 62 ▶ unless ref $args{ attributes } eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"attributes"} eq "ARRAY" 58 4 62
19  
20 66 $args{ attributes } = [ map { { Attribute => $_ } }
21 62 @{ $args{ attributes } }
22 ];
23  
24 62 $class->$orig( %args );
25 6 };
26  
27 20 ▶sub translate {
Subroutine translate: called CC=1 SCAR=0.0
Pod documented
28 20 my ($self, $variables) = @_;
29  
30 20 return $self->pattern->translate( $variables );
31 }
32  
33 4 ▶sub get_attribute_resource {
Subroutine get_attribute_resource: called CC=4 SCAR=14.3
Pod documented
34 4 my ($self, $attr_id) = @_;
35  
36 4 ▶ for my $attr ( @{ $self->attributes||[] } ) {
Condition50%1/2
$self->attributes || []
l!l
40
MC/DC0%0/1
$self->attributes || []
$self->attributes
Truth table50%1/2
A
A= $self->attributes
Aresult
11
00
37 6 ▶ return $attr
Branch: 1 branch
BranchTrueFalseTotal
if $attr->identifier eq $attr_id 4 2 6
38 if $attr->identifier eq $attr_id;
39  
40 }
41  
42 0 return;
43 }
44  
45  
46 6 1;
47  
48 __END__
« Fluent/Elements/SelectExpression.pm ↑ Summary Fluent/Elements/InlinePlaceable.pm »