Print/Mediainfo.pm

filter: Statementstmt 100% 36 / 36 Branchbran 62.5% 10 / 16 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 90.3% 56 / 62 CC 9 SCAR 17.6
CC
9
Cov
88%
print
10.1
BEGIN
1.0
BEGIN
1.0
CRAP 5.8
« Print/Value/Quantity.pm ↑ Summary Print/Value.pm »
1 package Wikibase::Datatype::Print::Mediainfo;
2  
3 6 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use Wikibase::Datatype::Print::MediainfoStatement;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use Wikibase::Datatype::Print::Utils qw(defaults print_descriptions print_labels
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 print_statements);
12 6 ▶use Wikibase::Datatype::Print::Value::Monolingual;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 6 Readonly::Array our @EXPORT_OK => qw(print);
15  
16 6 our $VERSION = 0.21;
17  
18 4 ▶sub print {
Subroutine print: called CC=9 SCAR=23.1
Pod documented
19 4 my ($obj, $opts_hr) = @_;
20  
21 4 $opts_hr = defaults($obj, $opts_hr);
22  
23 4 ▶ if (! $obj->isa('Wikibase::Datatype::Mediainfo')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::Mediainfo")) 1 3 4
24 1 err "Object isn't 'Wikibase::Datatype::Mediainfo'.";
25 }
26  
27 my @ret = (
28 defined $obj->id ? $opts_hr->{'texts'}->{'id'}.': '.$obj->id : (),
29 defined $obj->title ? $opts_hr->{'texts'}->{'title'}.': '.$obj->title : (),
30 defined $obj->ns ? $opts_hr->{'texts'}->{'ns'}.': '.$obj->ns : (),
31 defined $obj->lastrevid ? $opts_hr->{'texts'}->{'last_revision_id'}.': '.$obj->lastrevid : (),
32 defined $obj->modified ? $opts_hr->{'texts'}->{'date_of_modification'}.': '.$obj->modified : (),
33 3 ▶ defined $obj->page_id ? $opts_hr->{'texts'}->{'page_id'}.': '.$obj->page_id : (),
Branch: 6 branches
BranchTrueFalseTotal
defined $obj->id ? : 3 0 3
defined $obj->title ? : 3 0 3
defined $obj->ns ? : 3 0 3
defined $obj->lastrevid ? : 3 0 3
defined $obj->modified ? : 3 0 3
defined $obj->page_id ? : 0 3 3
34 );
35  
36 # Label.
37 3 push @ret, print_labels($obj, $opts_hr,
38 \&Wikibase::Datatype::Print::Value::Monolingual::print);
39  
40 # Description.
41 3 push @ret, print_descriptions($obj, $opts_hr,
42 \&Wikibase::Datatype::Print::Value::Monolingual::print);
43  
44 # Statements.
45 3 push @ret, print_statements($obj, $opts_hr,
46 \&Wikibase::Datatype::Print::MediainfoStatement::print);
47  
48 3 ▶ return wantarray ? @ret : (join "\n", @ret);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 1 3
49 }
50  
51 6 1;
52  
53 __END__
« Print/Value/Quantity.pm ↑ Summary Print/Value.pm »