Print/Value.pm

filter: Statementstmt 98.3% 61 / 62 Branchbran 95.0% 19 / 20 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 15 / 15 Podpod 100% 1 / 1 totaltotal 97.9% 96 / 98 CC 11 SCAR 16.9
CC
11
Cov
98%
print
11.0
BEGIN
1.0
BEGIN
1.0
CRAP 5.4
« Print/Mediainfo.pm ↑ Summary Print/Snak.pm »
1 package Wikibase::Datatype::Print::Value;
2  
3 44 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 44 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 44 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 44 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 44 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 44 ▶use Wikibase::Datatype::Print::Value::Globecoordinate;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 44 ▶use Wikibase::Datatype::Print::Value::Item;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 44 ▶use Wikibase::Datatype::Print::Value::Lexeme;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 44 ▶use Wikibase::Datatype::Print::Value::Monolingual;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 44 ▶use Wikibase::Datatype::Print::Value::Property;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 44 ▶use Wikibase::Datatype::Print::Value::Quantity;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 44 ▶use Wikibase::Datatype::Print::Value::Sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 44 ▶use Wikibase::Datatype::Print::Value::String;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 44 ▶use Wikibase::Datatype::Print::Value::Time;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 44 Readonly::Array our @EXPORT_OK => qw(print);
20  
21 44 our $VERSION = 0.21;
22  
23 75 ▶sub print {
Subroutine print: called CC=11 SCAR=24.0
Pod documented
24 75 my ($obj, $opts_hr) = @_;
25  
26 75 ▶ if (! $obj->isa('Wikibase::Datatype::Value')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::Value")) 1 74 75
27 1 err "Object isn't 'Wikibase::Datatype::Value'.";
28 }
29  
30 74 my $type = $obj->type;
31 74 my $ret;
32 74 ▶ if ($type eq 'globecoordinate') {
Branch: 9 branches
BranchTrueFalseTotal
if ($type eq 'globecoordinate') { } 1 73 74
elsif ($type eq 'item') { } 34 39 73
elsif ($type eq 'lexeme') { } 0 39 39
elsif ($type eq 'monolingualtext') { } 1 38 39
elsif ($type eq 'property') { } 1 37 38
elsif ($type eq 'quantity') { } 5 32 37
elsif ($type eq 'sense') { } 1 31 32
elsif ($type eq 'string') { } 24 7 31
elsif ($type eq 'time') { } 6 1 7
33 1 $ret = Wikibase::Datatype::Print::Value::Globecoordinate::print($obj, $opts_hr);
34 } elsif ($type eq 'item') {
35 34 $ret = Wikibase::Datatype::Print::Value::Item::print($obj, $opts_hr);
36 } elsif ($type eq 'lexeme') {
37 0 $ret = Wikibase::Datatype::Print::Value::Lexeme::print($obj, $opts_hr);
38 } elsif ($type eq 'monolingualtext') {
39 1 $ret = Wikibase::Datatype::Print::Value::Monolingual::print($obj, $opts_hr);
40 } elsif ($type eq 'property') {
41 1 $ret = Wikibase::Datatype::Print::Value::Property::print($obj, $opts_hr);
42 } elsif ($type eq 'quantity') {
43 5 $ret = Wikibase::Datatype::Print::Value::Quantity::print($obj, $opts_hr);
44 } elsif ($type eq 'sense') {
45 1 $ret = Wikibase::Datatype::Print::Value::Sense::print($obj, $opts_hr);
46 } elsif ($type eq 'string') {
47 24 $ret = Wikibase::Datatype::Print::Value::String::print($obj, $opts_hr);
48 } elsif ($type eq 'time') {
49 6 $ret = Wikibase::Datatype::Print::Value::Time::print($obj, $opts_hr);
50 } else {
51 1 err "Type '$type' is unsupported.";
52 }
53  
54 73 return $ret;
55 }
56  
57 44 1;
58  
59 __END__
« Print/Mediainfo.pm ↑ Summary Print/Snak.pm »