Print/Value/Property.pm

filter: Statementstmt 100% 29 / 29 Branchbran 100% 8 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 100% 49 / 49 CC 6 SCAR 13.2
CC
6
Cov
100%
print
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« Print/Value/Item.pm ↑ Summary Print.pm »
1 package Wikibase::Datatype::Print::Value::Property;
2  
3 47 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 47 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 47 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 47 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 47 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 47 Readonly::Array our @EXPORT_OK => qw(print);
11  
12 47 our $VERSION = 0.21;
13  
14 6 ▶sub print {
Subroutine print: called CC=6 SCAR=17.9
Pod documented
15 6 my ($obj, $opts_hr) = @_;
16  
17 6 ▶ if (! $obj->isa('Wikibase::Datatype::Value::Property')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::Value::Property")) 1 5 6
18 1 err "Object isn't 'Wikibase::Datatype::Value::Property'.";
19 }
20  
21 5 ▶ if (exists $opts_hr->{'cb'} && ! $opts_hr->{'cb'}->isa('Wikibase::Cache')) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $opts_hr->{"cb"} and not $opts_hr->{"cb"}->isa("Wikibase::Cache")) 1 4 5
Condition100%3/3
exists $opts_hr->{"cb"} and not $opts_hr->{"cb"}->isa("Wikibase::Cache")
!ll&&!rl&&r
221
MC/DC100%2/2
exists $opts_hr->{"cb"} and not $opts_hr->{"cb"}->isa("Wikibase::Cache")
exists $opts_hr->{"cb"} not $opts_hr->{"cb"}->isa("Wikibase::Cache")
Truth table100%3/3
A and not(B)
A= exists $opts_hr->{"cb"}B= not $opts_hr->{"cb"}->isa("Wikibase::Cache")
ABresult
0X0
100
111
22 1 err "Option 'cb' must be a instance of Wikibase::Cache.";
23 }
24  
25 4 my $property;
26 4 ▶ if (exists $opts_hr->{'cb'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $opts_hr->{"cb"}) 2 2 4
27 2 $property = $opts_hr->{'cb'}->get('label', $obj->value);
28 }
29 4 ▶ if (! defined $property) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $property) 3 1 4
30 3 $property = $obj->value;
31 }
32  
33 4 return $property;
34 }
35  
36 47 1;
37  
38 __END__
« Print/Value/Item.pm ↑ Summary Print.pm »