Print/Value/Lexeme.pm

filter: Statementstmt 100% 29 / 29 Branchbran 87.5% 7 / 8 Conditioncond 100% 3 / 3 MC/DCmcdc 100% 2 / 2 Subroutinesub 100% 6 / 6 Podpod 100% 1 / 1 totaltotal 97.9% 48 / 49 CC 6 SCAR 13.2
CC
6
Cov
98%
print
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.7
« Print/MediainfoSnak.pm ↑ Summary Print/Value/Item.pm »
1 package Wikibase::Datatype::Print::Value::Lexeme;
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 4 ▶sub print {
Subroutine print: called CC=6 SCAR=17.9
Pod documented
15 4 my ($obj, $opts_hr) = @_;
16  
17 4 ▶ if (! $obj->isa('Wikibase::Datatype::Value::Lexeme')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::Value::Lexeme")) 1 3 4
18 1 err "Object isn't 'Wikibase::Datatype::Value::Lexeme'.";
19 }
20  
21 3 ▶ 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 2 3
Condition100%3/3
exists $opts_hr->{"cb"} and not $opts_hr->{"cb"}->isa("Wikibase::Cache")
!ll&&!rl&&r
111
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 2 my $item;
26 2 ▶ if (exists $opts_hr->{'cb'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (exists $opts_hr->{"cb"}) 1 1 2
27 1 $item = $opts_hr->{'cb'}->get('label', $obj->value);
28 }
29 2 ▶ if (! defined $item) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined $item) 2 0 2
30 2 $item = $obj->value;
31 }
32  
33 2 return $item;
34 }
35  
36 47 1;
37  
38 __END__
« Print/MediainfoSnak.pm ↑ Summary Print/Value/Item.pm »