1 | <?php |
||
25 | class Vertex implements VertexInterface |
||
26 | { |
||
27 | use CoordinateCouple; |
||
28 | |||
29 | /** |
||
30 | * @var double |
||
31 | */ |
||
32 | protected $gradient; |
||
33 | |||
34 | /** |
||
35 | * @var double |
||
36 | */ |
||
37 | protected $ordinateIntercept; |
||
38 | |||
39 | /** |
||
40 | * @var integer |
||
41 | */ |
||
42 | private $precision = 8; |
||
43 | |||
44 | /** |
||
45 | * {@inheritDoc} |
||
46 | */ |
||
47 | 58 | public function setFrom(CoordinateInterface $from) |
|
65 | |||
66 | /** |
||
67 | * {@inheritDoc} |
||
68 | */ |
||
69 | 5 | public function getFrom() |
|
73 | |||
74 | /** |
||
75 | * {@inheritDoc} |
||
76 | */ |
||
77 | 49 | public function setTo(CoordinateInterface $to) |
|
95 | |||
96 | /** |
||
97 | * {@inheritDoc} |
||
98 | */ |
||
99 | 5 | public function getTo() |
|
103 | |||
104 | /** |
||
105 | * {@inheritDoc} |
||
106 | */ |
||
107 | 5 | public function getGradient() |
|
111 | |||
112 | /** |
||
113 | * {@inheritDoc} |
||
114 | */ |
||
115 | 2 | public function getOrdinateIntercept() |
|
119 | |||
120 | /** |
||
121 | * @return integer |
||
122 | */ |
||
123 | 5 | public function getPrecision() |
|
127 | |||
128 | /** |
||
129 | * @param integer $precision |
||
130 | * @return $this |
||
131 | */ |
||
132 | public function setPrecision($precision) |
||
138 | |||
139 | /** |
||
140 | * Returns the initial bearing from the origin coordinate |
||
141 | * to the destination coordinate in degrees. |
||
142 | * |
||
143 | * @return float The initial bearing in degrees |
||
144 | */ |
||
145 | 14 | public function initialBearing() |
|
158 | |||
159 | /** |
||
160 | * Returns the final bearing from the origin coordinate |
||
161 | * to the destination coordinate in degrees. |
||
162 | * |
||
163 | * @return float The final bearing in degrees |
||
164 | */ |
||
165 | 14 | public function finalBearing() |
|
178 | |||
179 | /** |
||
180 | * Returns the initial 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 initial cardinal point / direction |
||
185 | */ |
||
186 | 7 | public function initialCardinal() |
|
192 | |||
193 | /** |
||
194 | * Returns the final cardinal point / direction from the origin coordinate to |
||
195 | * the destination coordinate. |
||
196 | * @see http://en.wikipedia.org/wiki/Cardinal_direction |
||
197 | * |
||
198 | * @return string The final cardinal point / direction |
||
199 | */ |
||
200 | 7 | public function finalCardinal() |
|
206 | |||
207 | /** |
||
208 | * Returns the half-way point / coordinate along a great circle |
||
209 | * path between the origin and the destination coordinates. |
||
210 | * |
||
211 | * @return CoordinateInterface |
||
212 | */ |
||
213 | 7 | public function middle() |
|
230 | |||
231 | /** |
||
232 | * Returns the destination point with a given bearing in degrees travelling along a |
||
233 | * (shortest distance) great circle arc and a distance in meters. |
||
234 | * |
||
235 | * @param integer $bearing The bearing of the origin in degrees. |
||
236 | * @param integer $distance The distance from the origin in meters. |
||
237 | * |
||
238 | * @return CoordinateInterface |
||
239 | */ |
||
240 | 9 | public function destination($bearing, $distance) |
|
254 | |||
255 | /** |
||
256 | * Returns true if the vertex passed on argument is on the same line as this object |
||
257 | * |
||
258 | * @param Vertex $vertex The vertex to compare |
||
259 | * @return boolean |
||
260 | */ |
||
261 | 5 | public function isOnSameLine(Vertex $vertex) { |
|
274 | |||
275 | /** |
||
276 | * Returns the other coordinate who is not the coordinate passed on argument |
||
277 | * @param CoordinateInterface $coordinate |
||
278 | * @return null|Coordinate |
||
279 | */ |
||
280 | 3 | public function getOtherCoordinate(CoordinateInterface $coordinate) { |
|
288 | |||
289 | /** |
||
290 | * Returns the determinant value between $this (vertex) and another vertex. |
||
291 | * |
||
292 | * @param Vertex $vertex [description] |
||
293 | * @return [type] [description] |
||
294 | */ |
||
295 | 4 | public function getDeterminant(Vertex $vertex) { |
|
307 | |||
308 | } |
||
309 |
Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a mixed type is assigned to a property that is type hinted more strictly.
For example, imagine you have a variable
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.