Wikibase/Datatype/Value/Quantity.pm

filter: Statementstmt 100% 38 / 38 Branchbran 100% 10 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 50.0% 1 / 2 totaltotal 98.2% 57 / 58 CC 6 SCAR 12.0
CC
6
Cov
100%
BUILD
6.0
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« Wikibase/Datatype/Value/Globecoordinate.pm ↑ Summary Wikibase/Datatype/Snak.pm »
1 package Wikibase::Datatype::Value::Quantity;
2  
3 23 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 23 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 23 ▶use Error::Pure qw(err);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 23 ▶use Mo qw(build is);
Subroutine BEGIN: called CC=1 SCAR=0.0
8 23 ▶use Mo::utils qw(check_number);
Subroutine BEGIN: called CC=1 SCAR=0.0
9 23 ▶use Wikibase::Datatype::Utils qw(check_entity);
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 23 our $VERSION = 0.40;
12  
13 23 extends 'Wikibase::Datatype::Value';
14  
15 23 has lower_bound => (
16 is => 'ro',
17 );
18  
19 23 has unit => (
20 is => 'ro',
21 );
22  
23 23 has upper_bound => (
24 is => 'ro',
25 );
26  
27 1 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod documented
28 1 return 'quantity';
29 }
30  
31 21 ▶sub BUILD {
Subroutine BUILD: called CC=6 SCAR=17.9
Pod undocumented
32 21 my $self = shift;
33  
34 21 ▶ if (defined $self->{'unit'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"unit"}) 3 18 21
35 3 check_entity($self, 'unit');
36 }
37  
38 20 check_number($self, 'value');
39  
40 20 ▶ if (defined $self->{'lower_bound'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"lower_bound"}) 5 15 20
41 5 check_number($self, 'lower_bound');
42 5 ▶ if ($self->{'lower_bound'} > $self->{'value'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"lower_bound"} > $self->{"value"}) 1 4 5
43 1 err "Parameter 'lower_bound' must be less than or equal to value.";
44 }
45 }
46 19 ▶ if (defined $self->{'upper_bound'}) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $self->{"upper_bound"}) 5 14 19
47 5 check_number($self, 'upper_bound');
48 5 ▶ if ($self->{'upper_bound'} < $self->{'value'}) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"upper_bound"} < $self->{"value"}) 1 4 5
49 1 err "Parameter 'upper_bound' must be greater than or equal to value.";
50 }
51 }
52  
53 18 return;
54 }
55  
56 23 1;
57  
58 __END__
« Wikibase/Datatype/Value/Globecoordinate.pm ↑ Summary Wikibase/Datatype/Snak.pm »