Print/Lexeme.pm

filter: Statementstmt 100% 50 / 50 Branchbran 70.0% 7 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 11 / 11 Podpod 100% 1 / 1 totaltotal 95.8% 69 / 72 CC 6 SCAR 10.6
CC
6
Cov
95%
print
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.9
« Print/Form.pm ↑ Summary Print/Utils.pm »
1 package Wikibase::Datatype::Print::Lexeme;
2  
3 6 ▶use base qw(Exporter);
Subroutine BEGIN: called CC=1 SCAR=0.0
4 6 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 6 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 6 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 6 ▶use Readonly;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 6 ▶use Wikibase::Datatype::Print::Form;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 6 ▶use Wikibase::Datatype::Print::Sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 6 ▶use Wikibase::Datatype::Print::Statement;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 6 ▶use Wikibase::Datatype::Print::Utils qw(defaults print_forms print_senses print_statements);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use Wikibase::Datatype::Print::Value::Monolingual;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 Readonly::Array our @EXPORT_OK => qw(print);
16  
17 6 our $VERSION = 0.21;
18  
19 4 ▶sub print {
Subroutine print: called CC=6 SCAR=18.0
Pod documented
20 4 my ($obj, $opts_hr) = @_;
21  
22 4 $opts_hr = defaults($obj, $opts_hr);
23  
24 4 ▶ if (! $obj->isa('Wikibase::Datatype::Lexeme')) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($obj->isa("Wikibase::Datatype::Lexeme")) 1 3 4
25 1 err "Object isn't 'Wikibase::Datatype::Lexeme'.";
26 }
27  
28 my @ret = (
29 3 $opts_hr->{'texts'}->{'title'}.': '.$obj->title,
30 );
31  
32 # Lemmas.
33 3 my ($lemma) = @{$obj->lemmas};
34 3 ▶ if (defined $lemma) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $lemma) 3 0 3
35 3 push @ret, $opts_hr->{'texts'}->{'lemmas'}.': '.
36 Wikibase::Datatype::Print::Value::Monolingual::print($lemma, $opts_hr);
37 }
38  
39 # Language.
40 3 ▶ if ($obj->language) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->language) 3 0 3
41 push @ret, (
42 3 $opts_hr->{'texts'}->{'language'}.': '.$obj->language,
43 );
44 }
45  
46 # Lexical category.
47 3 ▶ if ($obj->lexical_category) {
Branch: 1 branch
BranchTrueFalseTotal
if ($obj->lexical_category) 3 0 3
48 push @ret, (
49 3 $opts_hr->{'texts'}->{'lexical_category'}.': '.$obj->lexical_category
50 );
51 }
52  
53 # Statements.
54 3 push @ret, print_statements($obj, $opts_hr,
55 \&Wikibase::Datatype::Print::Statement::print);
56  
57 # Senses.
58 3 push @ret, print_senses($obj, $opts_hr,
59 \&Wikibase::Datatype::Print::Sense::print);
60  
61 # Forms.
62 3 push @ret, print_forms($obj, $opts_hr,
63 \&Wikibase::Datatype::Print::Form::print);
64  
65 3 ▶ return wantarray ? @ret : (join "\n", @ret);
Branch: 1 branch
BranchTrueFalseTotal
wantarray ? : 2 1 3
66 }
67  
68 6 1;
69  
70 __END__
« Print/Form.pm ↑ Summary Print/Utils.pm »