| 1 | package Wikibase::Datatype::Print::Statement; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 25 | ▶ | use base qw(Exporter); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 25 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 25 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 25 | ▶ | use Error::Pure qw(err); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 25 | ▶ | use Readonly; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 25 | ▶ | use Wikibase::Datatype::Print::Reference; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 25 | ▶ | use Wikibase::Datatype::Print::Snak; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 25 | ▶ | use Wikibase::Datatype::Print::Utils qw(defaults print_references); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||
| 13 | 25 | Readonly::Array our @EXPORT_OK => qw(print); | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 25 | our $VERSION = 0.21; | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 34 | ▶ | sub print { | ||||||||||||||||||||||||||
|
Subroutine
print: called CC=6 SCAR=18.0
Pod
documented
| |||||||||||||||||||||||||||||
| 18 | 34 | my ($obj, $opts_hr) = @_; | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | 34 | $opts_hr = defaults($obj, $opts_hr); | |||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 34 | ▶ | if (! $obj->isa('Wikibase::Datatype::Statement')) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 23 | 1 | err "Object isn't 'Wikibase::Datatype::Statement'."; | |||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 33 | my $text_rank = $opts_hr->{'texts'}->{'rank_'.$obj->rank}; | |||||||||||||||||||||||||||
| 27 | 33 | my @ret = ( | |||||||||||||||||||||||||||
| 28 | Wikibase::Datatype::Print::Snak::print($obj->snak, $opts_hr).' ('.$text_rank.')', | ||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||
| 30 | 33 | foreach my $property_snak (@{$obj->property_snaks}) { | |||||||||||||||||||||||||||
| 31 | 8 | push @ret, ' '.Wikibase::Datatype::Print::Snak::print($property_snak, $opts_hr); | |||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||
| 34 | # References. | ||||||||||||||||||||||||||||
| 35 | 33 | ▶ | if (! exists $opts_hr->{'no_print_references'} || ! $opts_hr->{'no_print_references'}) { | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
exists $opts_hr->{"no_print_references"} and $opts_hr->{"no_print_references"}
MC/DC50%1/2
exists $opts_hr->{"no_print_references"} and $opts_hr->{"no_print_references"}
exists $opts_hr->{"no_print_references"}
$opts_hr->{"no_print_references"}
Truth table66%2/3
A and B
A= exists $opts_hr->{"no_print_references"}B= $opts_hr->{"no_print_references"}
| |||||||||||||||||||||||||||||
| 36 | 32 | push @ret, print_references($obj, $opts_hr, | |||||||||||||||||||||||||||
| 37 | \&Wikibase::Datatype::Print::Reference::print); | ||||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | 33 | ▶ | return wantarray ? @ret : (join "\n", @ret); | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||
| 43 | 25 | 1; | |||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | __END__ | ||||||||||||||||||||||||||||