Fluent/Elements/Term.pm

filter: Statementstmt 91.6% 22 / 24 Branchbran 100% 4 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 4 / 5 Podpod 100% 2 / 2 totaltotal 91.4% 32 / 35 CC 4 SCAR 7.6
CC
4
Cov
93%
get_attribute_resource
3.0
__ANON__
2.0
__ANON__
2.0
CRAP 2.1
« Fluent/Elements/Argument.pm ↑ Summary Fluent/Elements/Text.pm »
1 package Translate::Fluent::Elements::Term;
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 8 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=2 SCAR=6.9
12 8 my ($orig, $class, %args) = @_;
13  
14 8 $args{ identifier } = delete $args{ Identifier };
15 8 $args{ pattern } = delete $args{ Pattern };
16 8 $args{ attributes} = delete $args{ Attribute };
17 $args{ attributes } = [ $args{ attributes } ]
18 8 ▶ unless ref $args{ attributes } eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $args{"attributes"} eq "ARRAY" 4 4 8
19  
20 12 $args{ attributes } = [ map { { Attribute => $_ } }
21 8 @{ $args{ attributes } }
22 ];
23  
24 8 $class->$orig( %args );
25 6 };
26  
27 6 ▶sub translate {
Subroutine translate: called CC=1 SCAR=0.0
Pod documented
28 6 my ($self, $variables) = @_;
29  
30 6 return $self->pattern->translate( $variables );
31 }
32  
33 9 ▶sub get_attribute_resource {
Subroutine get_attribute_resource: called CC=3 SCAR=11.1
Pod documented
34 9 my ($self, $attr_id) = @_;
35  
36 9 for my $attr ( @{ $self->attributes } ) {
37 15 ▶ return $attr
Branch: 1 branch
BranchTrueFalseTotal
if $attr->identifier eq $attr_id 9 6 15
38 if $attr->identifier eq $attr_id;
39  
40 }
41  
42 0 return;
43 }
44  
45  
46 6 1;
47 __END__
« Fluent/Elements/Argument.pm ↑ Summary Fluent/Elements/Text.pm »