1 | <?php |
||
19 | class Path { |
||
20 | use MagicGet; |
||
21 | |||
22 | /** |
||
23 | * @var integer[] $nodes Added points' ids to current path. |
||
24 | * @var integer $distance Distance of the path. |
||
25 | */ |
||
26 | private $nodes = array(); |
||
27 | private $distance = 0; |
||
28 | |||
29 | /** |
||
30 | * Method adds node to end of current path. |
||
31 | * |
||
32 | * @param Point|integer $point Point object or point identifier. |
||
33 | * @param integer $distance Distance between this node and the last one in path. |
||
34 | * @return Path Reference to current object. |
||
35 | * @throws PathException Method throws exception when checkDistance() method throws exception. |
||
36 | */ |
||
37 | public function addNode($point, $distance = 0) |
||
51 | |||
52 | /** |
||
53 | * Method checks given $distance value. |
||
54 | * |
||
55 | * @param integer $distance |
||
56 | * @throws PathException Method throws exception when $distance is not numeric value or when $distance is less or equal to 0. |
||
57 | */ |
||
58 | public function checkDistance($distance) |
||
64 | |||
65 | /** |
||
66 | * Method copy data of given Path object to current class instance. |
||
67 | * |
||
68 | * @param Path $path Path object whose data we want to copy. |
||
69 | * @return Path $this Reference to current object. |
||
70 | */ |
||
71 | public function copy(self $path) |
||
78 | } |
||
79 |