Print/MediainfoStatement.pm

filter: Statementstmt 97.3% 37 / 38 Branchbran 75.0% 3 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 96.1% 50 / 52 CC 4 SCAR 7.0
CC
4
Cov
95%
print
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Print/Reference.pm ↑ Summary Print/Texts.pm »
1 package Wikibase::Datatype::Print::MediainfoStatement;
2  
3 9 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 9 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 9 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use Wikibase::Datatype::Print::Reference;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 9 ▶use Wikibase::Datatype::Print::MediainfoSnak;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 9 ▶use Wikibase::Datatype::Print::Utils qw(defaults print_references);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 9 Readonly::Array our @EXPORT_OK => qw(print);
14  
15 9 our $VERSION = 0.21;
16  
17 5 ▶sub print {
Subroutine print: called CC=4 SCAR=14.0
Pod documented
18 5 my ($obj, $opts_hr) = @_;
19  
20 5 $opts_hr = defaults($obj, $opts_hr);
21  
22 5 ▶ if (! $obj->isa('Wikibase::Datatype::MediainfoStatement')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::MediainfoStatement")) 1 4 5
23 1 err "Object isn't 'Wikibase::Datatype::MediainfoStatement'.";
24 }
25  
26 4 my $text_rank = $opts_hr->{'texts'}->{'rank_'.$obj->rank};
27 4 my @ret = (
28 Wikibase::Datatype::Print::MediainfoSnak::print($obj->snak, $opts_hr).' ('.$text_rank.')',
29 );
30 4 foreach my $property_snak (@{$obj->property_snaks}) {
31 0 push @ret, ' '.Wikibase::Datatype::Print::MediainfoSnak::print($property_snak, $opts_hr);
32 }
33  
34 # References.
35 4 push @ret, print_references($obj, $opts_hr,
36 \&Wikibase::Datatype::Print::Reference::print);
37  
38 4 ▶ return wantarray ? @ret : (join "\n", @ret);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 4 0 4
39 }
40  
41 9 1;
42  
43 __END__
« Print/Reference.pm ↑ Summary Print/Texts.pm »