1 | <?php |
||
24 | class Vertex extends AbstractGeotools implements VertexInterface |
||
25 | { |
||
26 | /** |
||
27 | * @var integer |
||
28 | */ |
||
29 | protected $gradient; |
||
30 | |||
31 | /** |
||
32 | * @var integer |
||
33 | */ |
||
34 | protected $ordinateIntercept; |
||
35 | |||
36 | /** |
||
37 | * @var integer |
||
38 | */ |
||
39 | private $precision = 8; |
||
40 | |||
41 | /** |
||
42 | * {@inheritDoc} |
||
43 | */ |
||
44 | 51 | public function setFrom(CoordinateInterface $from) |
|
56 | |||
57 | /** |
||
58 | * {@inheritDoc} |
||
59 | */ |
||
60 | 1 | public function getFrom() |
|
64 | |||
65 | /** |
||
66 | * {@inheritDoc} |
||
67 | */ |
||
68 | 42 | public function setTo(CoordinateInterface $to) |
|
81 | |||
82 | /** |
||
83 | * {@inheritDoc} |
||
84 | */ |
||
85 | 1 | public function getTo() |
|
89 | |||
90 | /** |
||
91 | * {@inheritDoc} |
||
92 | */ |
||
93 | 5 | public function getGradient() |
|
97 | |||
98 | /** |
||
99 | * {@inheritDoc} |
||
100 | */ |
||
101 | 2 | public function getOrdinateIntercept() |
|
105 | |||
106 | /** |
||
107 | * @return integer |
||
108 | */ |
||
109 | 5 | public function getPrecision() |
|
113 | |||
114 | /** |
||
115 | * @param integer $precision |
||
116 | * @return $this |
||
117 | */ |
||
118 | public function setPrecision($precision) |
||
124 | |||
125 | /** |
||
126 | * Returns the initial bearing from the origin coordinate |
||
127 | * to the destination coordinate in degrees. |
||
128 | * |
||
129 | * @return float The initial bearing in degrees |
||
130 | */ |
||
131 | 14 | public function initialBearing() |
|
144 | |||
145 | /** |
||
146 | * Returns the final bearing from the origin coordinate |
||
147 | * to the destination coordinate in degrees. |
||
148 | * |
||
149 | * @return float The final bearing in degrees |
||
150 | */ |
||
151 | 14 | public function finalBearing() |
|
164 | |||
165 | /** |
||
166 | * Returns the initial cardinal point / direction from the origin coordinate to |
||
167 | * the destination coordinate. |
||
168 | * @see http://en.wikipedia.org/wiki/Cardinal_direction |
||
169 | * |
||
170 | * @return string The initial cardinal point / direction |
||
171 | */ |
||
172 | 7 | public function initialCardinal() |
|
178 | |||
179 | /** |
||
180 | * Returns the final cardinal point / direction from the origin coordinate to |
||
181 | * the destination coordinate. |
||
182 | * @see http://en.wikipedia.org/wiki/Cardinal_direction |
||
183 | * |
||
184 | * @return string The final cardinal point / direction |
||
185 | */ |
||
186 | 7 | public function finalCardinal() |
|
192 | |||
193 | /** |
||
194 | * Returns the half-way point / coordinate along a great circle |
||
195 | * path between the origin and the destination coordinates. |
||
196 | * |
||
197 | * @return CoordinateInterface |
||
198 | */ |
||
199 | 7 | public function middle() |
|
216 | |||
217 | /** |
||
218 | * Returns the destination point with a given bearing in degrees travelling along a |
||
219 | * (shortest distance) great circle arc and a distance in meters. |
||
220 | * |
||
221 | * @param integer $bearing The bearing of the origin in degrees. |
||
222 | * @param integer $distance The distance from the origin in meters. |
||
223 | * |
||
224 | * @return CoordinateInterface |
||
225 | */ |
||
226 | 9 | public function destination($bearing, $distance) |
|
240 | |||
241 | /** |
||
242 | * Returns true if the vertex passed on argument is on the same line as this object |
||
243 | * |
||
244 | * @param Vertex $vertex The vertex to compare |
||
245 | * @return boolean |
||
246 | */ |
||
247 | 5 | public function isOnSameLine(Vertex $vertex) { |
|
260 | |||
261 | /** |
||
262 | * Returns the other coordinate who is not the coordinate passed on argument |
||
263 | * @param Coordinate $point |
||
264 | * @return null|Coordinate |
||
265 | */ |
||
266 | public function getOtherCoordinate(CoordinateInterface $coordinate) { |
||
274 | |||
275 | } |
||
276 |
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.