| 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
| |||||||||||||
| 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 || []
MC/DC0%0/1
$self->attributes || []
$self->attributes
Truth table50%1/2
A
A= $self->attributes
| |||||||||||||
| 37 | 6 | ▶ | return $attr | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 38 | if $attr->identifier eq $attr_id; | ||||||||||||
| 39 | |||||||||||||
| 40 | } | ||||||||||||
| 41 | |||||||||||||
| 42 | 0 | return; | |||||||||||
| 43 | } | ||||||||||||
| 44 | |||||||||||||
| 45 | |||||||||||||
| 46 | 6 | 1; | |||||||||||
| 47 | |||||||||||||
| 48 | __END__ | ||||||||||||