NewsML_G2/Role/Writer/News_Item_Video.pm

filter: Statementstmt 100% 31 / 31 Branchbran 75.0% 6 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 95.4% 42 / 44 CC 8 SCAR 13.0
CC
8
Cov
95%
__ANON__
5.0
_create_icon
4.0
BEGIN
1.0
CRAP 3.7
« NewsML_G2/Writer/Substancial_Item.pm ↑ Summary NewsML_G2/Writer/Event_Item.pm »
1 package XML::NewsML_G2::Role::Writer::News_Item_Video;
2  
3 3 ▶use Moose::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 3 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 3 with 'XML::NewsML_G2::Role::Writer';
7  
8 9 ▶around '_build_g2_catalog_schemes' => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
9 9 my ( $orig, $self, @args ) = @_;
10 9 my $result = $self->$orig(@args);
11 9 $result->{rnd} = undef;
12 9 return $result;
13 3 };
14  
15 14 ▶after '_create_remote_content' => sub {
Subroutine __ANON__: called CC=5 SCAR=16.1
16 14 my ( $self, $root, $video ) = @_;
17  
18 14 foreach (
19 qw/size width height duration videoframerate videoavgbitrate audiosamplerate/
20 ) {
21 98 ▶ $root->setAttribute( $_, $video->$_ ) if defined $video->$_;
Branch: 1 branch
BranchTrueFalseTotal
if defined $video->$_ 56 42 98
22 }
23  
24 14 my $rendition =
25 $self->scheme_manager->build_qcode( 'vidrnd', $video->rendition );
26 14 ▶ $root->setAttribute( 'rendition', $rendition ) if $rendition;
Branch: 1 branch
BranchTrueFalseTotal
if $rendition 0 14 14
27  
28 14 my $audiochannels =
29 $self->scheme_manager->build_qcode( 'adc', $video->audiochannels );
30 14 ▶ $root->setAttribute( 'audiochannels', $audiochannels ) if $audiochannels;
Branch: 1 branch
BranchTrueFalseTotal
if $audiochannels 9 5 14
31 3 };
32  
33 9 ▶sub _create_icon {
Subroutine _create_icon: called CC=4 SCAR=13.9
34 9 my ( $self, $root ) = @_;
35  
36 9 for my $icon ( @{ $self->news_item->icon } ) {
37 10 my $rendition =
38 $self->scheme_manager->build_qcode( 'rnd', $icon->rendition );
39 10 my $icon_element =
40 $self->create_element( 'icon', rendition => $rendition, );
41  
42 10 foreach (qw/href width height/) {
43 30 ▶ next unless $icon->$_;
Branch: 1 branch
BranchTrueFalseTotal
unless $icon->$_ 0 30 30
44 30 $icon_element->setAttribute( $_, $icon->$_ );
45 }
46 10 $root->appendChild($icon_element);
47 }
48 9 return;
49 }
50  
51 3 1;
52 __END__
« NewsML_G2/Writer/Substancial_Item.pm ↑ Summary NewsML_G2/Writer/Event_Item.pm »