|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Geotools library. |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Antoine Corcy <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace League\Geotools; |
|
13
|
|
|
|
|
14
|
|
|
use League\Geotools\Coordinate\CoordinateInterface; |
|
15
|
|
|
use League\Geotools\Distance\Distance; |
|
16
|
|
|
use League\Geotools\Vertex\Vertex; |
|
17
|
|
|
use League\Geotools\Batch\Batch; |
|
18
|
|
|
use League\Geotools\Geohash\Geohash; |
|
19
|
|
|
use League\Geotools\Convert\Convert; |
|
20
|
|
|
use Geocoder\Geocoder; |
|
21
|
|
|
|
|
22
|
|
|
/** |
|
23
|
|
|
* Geotools class |
|
24
|
|
|
* |
|
25
|
|
|
* @author Antoine Corcy <[email protected]> |
|
26
|
|
|
*/ |
|
27
|
|
|
class Geotools implements GeotoolsInterface |
|
28
|
|
|
{ |
|
29
|
|
|
/** |
|
30
|
|
|
* Version. |
|
31
|
|
|
* @see http://semver.org/ |
|
32
|
|
|
*/ |
|
33
|
|
|
const VERSION = '0.7.1-dev'; |
|
34
|
|
|
|
|
35
|
|
|
/** |
|
36
|
|
|
* The cardinal points / directions (the four cardinal directions, |
|
37
|
|
|
* the four ordinal directions, plus eight further divisions). |
|
38
|
|
|
* |
|
39
|
|
|
* @var array |
|
40
|
|
|
*/ |
|
41
|
|
|
public static $cardinalPoints = array( |
|
42
|
|
|
'N', 'NNE', 'NE', 'ENE', |
|
43
|
|
|
'E', 'ESE', 'SE', 'SSE', |
|
44
|
|
|
'S', 'SSW', 'SW', 'WSW', |
|
45
|
|
|
'W', 'WNW', 'NW', 'NNW', |
|
46
|
|
|
'N' |
|
47
|
|
|
); |
|
48
|
|
|
|
|
49
|
|
|
/** |
|
50
|
|
|
* Latitude bands in the UTM coordinate system. |
|
51
|
|
|
* @see http://en.wikipedia.org/wiki/Universal_Transverse_Mercator_coordinate_system |
|
52
|
|
|
* |
|
53
|
|
|
* @var array |
|
54
|
|
|
*/ |
|
55
|
|
|
public static $latitudeBands = array( |
|
56
|
|
|
'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K', 'L', 'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'X' |
|
57
|
|
|
); |
|
58
|
|
|
|
|
59
|
|
|
|
|
60
|
|
|
/** |
|
61
|
|
|
* {@inheritDoc} |
|
62
|
|
|
*/ |
|
63
|
29 |
|
public function distance() |
|
64
|
|
|
{ |
|
65
|
29 |
|
return new Distance; |
|
66
|
|
|
} |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* {@inheritDoc} |
|
70
|
|
|
*/ |
|
71
|
15 |
|
public function vertex() |
|
72
|
|
|
{ |
|
73
|
15 |
|
return new Vertex; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
/** |
|
77
|
|
|
* {@inheritDoc} |
|
78
|
|
|
*/ |
|
79
|
1 |
|
public function batch(Geocoder $geocoder) |
|
80
|
|
|
{ |
|
81
|
1 |
|
return new Batch($geocoder); |
|
|
|
|
|
|
82
|
|
|
} |
|
83
|
|
|
|
|
84
|
|
|
/** |
|
85
|
|
|
* {@inheritDoc} |
|
86
|
|
|
*/ |
|
87
|
8 |
|
public function geohash() |
|
88
|
|
|
{ |
|
89
|
8 |
|
return new Geohash; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* {@inheritDoc} |
|
94
|
|
|
*/ |
|
95
|
13 |
|
public function convert(CoordinateInterface $coordinates) |
|
96
|
|
|
{ |
|
97
|
13 |
|
return new Convert($coordinates); |
|
98
|
|
|
} |
|
99
|
|
|
} |
|
100
|
|
|
|
This check looks for parameters that are defined as one type in their type hint or doc comment but seem to be used as a narrower type, i.e an implementation of an interface or a subclass.
Consider changing the type of the parameter or doing an instanceof check before assuming your parameter is of the expected type.