Neo4j/Types/Generic/Point.pm

filter: Statementstmt 100% 34 / 34 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 14 / 14 Podpod 22.2% 2 / 9 totaltotal 88.8% 56 / 63 CC 4 SCAR 5.3
CC
4
Cov
100%
new
4.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.7
« Test/Neo4j/Types.pm ↑ Summary Neo4j/Types/Generic/Duration.pm »
1 3 ▶use v5.10.1;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 3 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 3 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 package Neo4j::Types::Generic::Point;
6 # ABSTRACT: Generic representation of a Neo4j spatial point value
7 3 $Neo4j::Types::Generic::Point::VERSION = '2.00';
8  
9 3 ▶use parent 'Neo4j::Types::Point';
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 3 ▶use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13  
14 3 my %DIM = ( 4326 => 2, 4979 => 3, 7203 => 2, 9157 => 3 );
15  
16 33 ▶sub new {
Subroutine new: called CC=4 SCAR=13.9
Pod undocumented
17 # uncoverable pod - see Generic.pod
18 33 my ($class, $srid, @coordinates) = @_;
19
20 33 ▶ croak "Points must have SRID" unless defined $srid;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $srid 4 29 33
21 29 my $dim = $DIM{$srid};
22 29 ▶ croak "Unsupported SRID $srid" unless defined $dim;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $dim 4 25 29
23 25 ▶ croak "Points with SRID $srid must have $dim dimensions" if @coordinates < $dim;
Branch: 1 branch
BranchTrueFalseTotal
if @coordinates < $dim 6 19 25
24 19 return bless [ $srid, @coordinates[0 .. $dim - 1] ], __PACKAGE__;
25 }
26  
27  
28 2 ▶sub X {
Subroutine X: called CC=1 SCAR=0.0
Pod undocumented
29 # uncoverable pod - see Generic.pod
30 2 return shift->[1];
31 }
32  
33  
34 2 ▶sub longitude {
Subroutine longitude: called CC=1 SCAR=0.0
Pod undocumented
35 # uncoverable pod - see Generic.pod
36 2 return shift->[1];
37 }
38  
39  
40 2 ▶sub Y {
Subroutine Y: called CC=1 SCAR=0.0
Pod undocumented
41 # uncoverable pod - see Generic.pod
42 2 return shift->[2];
43 }
44  
45  
46 2 ▶sub latitude {
Subroutine latitude: called CC=1 SCAR=0.0
Pod undocumented
47 # uncoverable pod - see Generic.pod
48 2 return shift->[2];
49 }
50  
51  
52 2 ▶sub Z {
Subroutine Z: called CC=1 SCAR=0.0
Pod undocumented
53 # uncoverable pod - see Generic.pod
54 2 return shift->[3];
55 }
56  
57  
58 2 ▶sub height {
Subroutine height: called CC=1 SCAR=0.0
Pod undocumented
59 # uncoverable pod - see Generic.pod
60 2 return shift->[3];
61 }
62  
63  
64 14 ▶sub srid {
Subroutine srid: called CC=1 SCAR=0.0
Pod documented
65 14 return shift->[0];
66 }
67  
68  
69 29 ▶sub coordinates {
Subroutine coordinates: called CC=1 SCAR=0.0
Pod documented
70 29 my @coordinates = @{$_[0]}[ 1 .. $#{$_[0]} ];
71 29 return @coordinates;
72 }
73  
74  
75 3 1;
« Test/Neo4j/Types.pm ↑ Summary Neo4j/Types/Generic/Duration.pm »