forked from geocoder-php/php-common
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathBounds.php
More file actions
116 lines (103 loc) · 1.98 KB
/
Copy pathBounds.php
File metadata and controls
116 lines (103 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
/**
* This file is part of the Geocoder package.
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* @license MIT License
*/
namespace Geocoder\Model;
/**
* @author William Durand <[email protected]>
*/
final class Bounds
{
/**
* @var double
*/
private $south;
/**
* @var double
*/
private $west;
/**
* @var double
*/
private $north;
/**
* @var double
*/
private $east;
/**
* @param double $south
* @param double $west
* @param double $north
* @param double $east
*/
public function __construct($south, $west, $north, $east)
{
$this->south = $south;
$this->west = $west;
$this->north = $north;
$this->east = $east;
}
/**
* Returns the south bound.
*
* @return double
*/
public function getSouth()
{
return $this->south;
}
/**
* Returns the west bound.
*
* @return double
*/
public function getWest()
{
return $this->west;
}
/**
* Returns the north bound.
*
* @return double
*/
public function getNorth()
{
return $this->north;
}
/**
* Returns the east bound.
*
* @return double
*/
public function getEast()
{
return $this->east;
}
/**
* Returns whether or not bounds are defined
*
* @return bool
*/
public function isDefined()
{
return !empty($this->south) && !empty($this->east) && !empty($this->north) && !empty($this->west);
}
/**
* Returns an array with bounds.
*
* @return array
*/
public function toArray()
{
return [
'south' => $this->getSouth(),
'west' => $this->getWest(),
'north' => $this->getNorth(),
'east' => $this->getEast()
];
}
}