1 | <?php namespace Arcanedev\GeoLocation\Entities\Coordinates; |
||
13 | class Viewport implements ViewportContract |
||
14 | { |
||
15 | /* ----------------------------------------------------------------- |
||
16 | | Traits |
||
17 | | ----------------------------------------------------------------- |
||
18 | */ |
||
19 | |||
20 | use CanBeJsonable; |
||
21 | |||
22 | /* ----------------------------------------------------------------- |
||
23 | | Properties |
||
24 | | ----------------------------------------------------------------- |
||
25 | */ |
||
26 | |||
27 | /** @var \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position */ |
||
28 | protected $northeast; |
||
29 | |||
30 | /** @var \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position */ |
||
31 | protected $southwest; |
||
32 | |||
33 | /* ----------------------------------------------------------------- |
||
34 | | Constructor |
||
35 | | ----------------------------------------------------------------- |
||
36 | */ |
||
37 | |||
38 | /** |
||
39 | * Viewport constructor. |
||
40 | * |
||
41 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $northeast |
||
42 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $southwest |
||
43 | */ |
||
44 | 42 | public function __construct(PositionContract $northeast, PositionContract $southwest) |
|
48 | |||
49 | /* ----------------------------------------------------------------- |
||
50 | | Getters & Setters |
||
51 | | ----------------------------------------------------------------- |
||
52 | */ |
||
53 | |||
54 | /** |
||
55 | * Get the North/East coordinates. |
||
56 | * |
||
57 | * @return \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position |
||
58 | */ |
||
59 | 6 | public function getNorthEast() |
|
63 | |||
64 | /** |
||
65 | * Set the North/East coordinates. |
||
66 | * |
||
67 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $northeast |
||
68 | * |
||
69 | * @return self |
||
70 | */ |
||
71 | 42 | public function setNorthEast(PositionContract $northeast) |
|
77 | |||
78 | /** |
||
79 | * Get the South/West coordinates. |
||
80 | * |
||
81 | * @return \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position |
||
82 | */ |
||
83 | 6 | public function getSouthWest() |
|
87 | |||
88 | /** |
||
89 | * Set the South/West coordinates. |
||
90 | * |
||
91 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $southwest |
||
92 | * |
||
93 | * @return self |
||
94 | */ |
||
95 | 42 | public function setSouthWest(PositionContract $southwest) |
|
101 | |||
102 | /* ----------------------------------------------------------------- |
||
103 | | Main Methods |
||
104 | | ----------------------------------------------------------------- |
||
105 | */ |
||
106 | |||
107 | /** |
||
108 | * Create a new viewport instance. |
||
109 | * |
||
110 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $northeast |
||
111 | * @param \Arcanedev\GeoLocation\Contracts\Entities\Coordinates\Position $southwest |
||
112 | * |
||
113 | * @return self |
||
114 | */ |
||
115 | 39 | public static function create(PositionContract $northeast, PositionContract $southwest) |
|
119 | |||
120 | /** |
||
121 | * Get the instance as an array. |
||
122 | * |
||
123 | * @return array |
||
124 | */ |
||
125 | 21 | public function toArray() |
|
132 | } |
||
133 |