Print/Value/Item.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/Lexeme.pm ↑ Summary Print/Value/Property.pm »
1 package Wikibase::Datatype::Print::Value::Item;
2  
3 51 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 51 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 51 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 51 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 51 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 51 Readonly::Array our @EXPORT_OK => qw(print);
11  
12 51 our $VERSION = 0.21;
13  
14 53 ▶sub print {
Subroutine print: called CC=6 SCAR=17.9
Pod documented
15 53 my ($obj, $opts_hr) = @_;
16  
17 53 ▶ if (! $obj->isa('Wikibase::Datatype::Value::Item')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::Value::Item")) 1 52 53
18 1 err "Object isn't 'Wikibase::Datatype::Value::Item'.";
19 }
20  
21 52 ▶ 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 51 52
Condition100%3/3
exists $opts_hr->{"cb"} and not $opts_hr->{"cb"}->isa("Wikibase::Cache")
!ll&&!rl&&r
4921
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 51 my $item;
26 51 ▶ if (exists $opts_hr->{'cb'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $opts_hr->{"cb"}) 2 49 51
27 2 $item = $opts_hr->{'cb'}->get('label', $obj->value);
28 }
29 51 ▶ if (! defined $item) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $item) 50 1 51
30 50 $item = $obj->value;
31 }
32  
33 51 return $item;
34 }
35  
36 51 1;
37  
38 __END__
« Print/Value/Lexeme.pm ↑ Summary Print/Value/Property.pm »