Fluent/Elements/MessageReference.pm

filter: Statementstmt 94.7% 18 / 19 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 100% 1 / 1 totaltotal 86.6% 26 / 30 CC 4 SCAR 10.6
CC
4
Cov
88%
translate
4.1
__ANON__
2.0
BEGIN
1.0
CRAP 2.9
« Fluent/Parser.pm ↑ Summary Fluent/Elements/ArgumentList.pm »
1 package Translate::Fluent::Elements::MessageReference;
2  
3 6 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 extends 'Translate::Fluent::Elements::Base';
5  
6 has [qw(
7 identifier
8 attribute_accessor
9 )] => (
10 is => 'ro',
11 0 ▶ default => sub { undef },
Subroutine __ANON__: not called CC=1 SCAR=6.9
12 6 );
13  
14 16 ▶around BUILDARGS => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
15 16 my ($orig, $class, %args) = @_;
16  
17 16 $args{identifier} = delete $args{ Identifier };
18 16 $args{attribute_accessor} = delete $args{ AttributeAccessor };
19  
20 16 $class->$orig( %args );
21 6 };
22  
23 6 ▶sub translate {
Subroutine translate: called CC=4 SCAR=14.0
Pod documented
24 6 my ($self, $variables) = @_;
25  
26 6 my $message = $variables->{__resourceset}->get_message( $self->identifier );
27 6 ▶ return unless $message;
Branch: 1 branch
BranchTrueFalseTotal
unless $message 0 6 6
28  
29 6 ▶ if ($self->attribute_accessor) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->attribute_accessor) 4 2 6
30 4 $message = $message->get_attribute_resource(
31 $self->attribute_accessor->identifier
32 );
33 }
34  
35 6 ▶ return unless $message;
Branch: 1 branch
BranchTrueFalseTotal
unless $message 0 6 6
36  
37 # Not sure if this should be called with no variables
38 # or with the variables the parent was called with
39 # so going with the later for now.
40 6 return $message->translate( $variables );
41 }
42  
43 6 1;
44 __END__
« Fluent/Parser.pm ↑ Summary Fluent/Elements/ArgumentList.pm »