1 | <?php |
||
20 | class Dijkstra { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | private $points = array(); |
||
25 | |||
26 | /** |
||
27 | * Dijkstra constructor. |
||
28 | * |
||
29 | * @param Closure|null $function Anonymous function to create relations. |
||
30 | */ |
||
31 | public function __construct($function = null) |
||
37 | |||
38 | /** |
||
39 | * Method executes sent function and add result to $points parameter. |
||
40 | * |
||
41 | * @param Closure $function Anonymous function to create relations. |
||
42 | * @return Dijkstra $this Reference to the same object. |
||
43 | * @throws Exception Method throws exception when $function argument isn't a Closure object. |
||
44 | */ |
||
45 | public function add($function) |
||
69 | |||
70 | /** |
||
71 | * Method search unvisited points in neighborhood of sent point. |
||
72 | * |
||
73 | * @param integer[] $visited Array of visited points' ids. |
||
74 | * @param integer $point Point id. |
||
75 | * @return boolean True when exists unvisited point in neighborhood or false otherwise. |
||
76 | */ |
||
77 | private function existsUnvisitedInNeighborhood($visited, $point) |
||
87 | |||
88 | /** |
||
89 | * @param integer[] $unvisited Array of unvisited points' ids. |
||
90 | * @param integer[] $visited Array of visited points' ids. |
||
91 | * @param integer|null $startPoint Start point id. |
||
92 | * @return integer|null Method returns point identifier where it exists in $unvisited array or null otherwise. |
||
93 | */ |
||
94 | private function findPointWithUncheckedRelation($unvisited, $visited, $startPoint = null) |
||
112 | |||
113 | /** |
||
114 | * Method generates path for given Point object or point id. |
||
115 | * |
||
116 | * @param Point|integer $point Point object or point identification number. |
||
117 | * @return Path[] Array of Path objects. |
||
118 | * @throws Exception Throws exception when sent point not isset in object's $point array. |
||
119 | */ |
||
120 | public function generate($point) |
||
161 | |||
162 | /** |
||
163 | * Method generates paths for all defined points. |
||
164 | * |
||
165 | * @return Path[][] Two-dimensional array of Path objects. |
||
166 | * @throws Exception Method throws exception when generate() method throws exception. |
||
167 | */ |
||
168 | public function generateAll() |
||
178 | |||
179 | /** |
||
180 | * Method try to find minimal relation to another point from given point. |
||
181 | * |
||
182 | * @param integer[] $unvisited Array of unvisited points' ids. |
||
183 | * @param Path[] $paths Array of generated Path objects. |
||
184 | * @param integer $point Point integer identifier. |
||
185 | * @return Dijkstra\Relation|null Method returns Relation object or null when minimal relation wasn't found. |
||
186 | */ |
||
187 | private function getMinimalRelation($unvisited, $paths, $point) |
||
206 | |||
207 | /** |
||
208 | * Method gets from Point object identifier or checks given value. If this value not exists in $points object property then throws exception. |
||
209 | * |
||
210 | * @param mixed $point Value to check. |
||
211 | * @return integer Point identifier. |
||
212 | * @throws Exception Method throws exception when given value not exists in $points array. |
||
213 | */ |
||
214 | private function getPointID($point) |
||
226 | |||
227 | /** |
||
228 | * Method updates existing Path object or create new if it's possible. |
||
229 | * |
||
230 | * @param Path[] &$paths Array of generated Path[] objects. Given by reference. |
||
231 | * @param integer $point Integer point identifier. |
||
232 | */ |
||
233 | public function updatePaths(&$paths, $point) |
||
247 | } |
||
248 |
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.