1 | <?php |
||
16 | class Creator { |
||
17 | /** |
||
18 | * @var Point[] $points Array of collected Point objects. |
||
19 | */ |
||
20 | private $points = array(); |
||
21 | |||
22 | /** |
||
23 | * Method adds Point to current object. Can set point's label. |
||
24 | * |
||
25 | * @param string|null $label Point's label. |
||
26 | * @return Point Reference to created Point object. |
||
27 | */ |
||
28 | public function addPoint($label = null) |
||
36 | |||
37 | /** |
||
38 | * Method generates integer ids to collected points and drop them out. |
||
39 | * |
||
40 | * @return Point[] Array of Point objects. |
||
41 | */ |
||
42 | public function dumpPoints() |
||
50 | |||
51 | /** |
||
52 | * Method returns collected Point object by given $index value. |
||
53 | * |
||
54 | * @param integer $index Point's index. |
||
55 | * @return Point|null Point object if element with $index value exists or null otherwise. |
||
56 | */ |
||
57 | public function getPoint($index) |
||
65 | |||
66 | /** |
||
67 | * Method search $points object parameter and try to find Point identifier. |
||
68 | * |
||
69 | * @param Point $point Point object which we want to find. |
||
70 | * @return mixed Returns key of $point or false if key isn't exists. |
||
71 | */ |
||
72 | public function getPointIndex(Point $point) |
||
76 | |||
77 | /** |
||
78 | * Method returns collected Point object by given $index value or throws exception if index does not exists. |
||
79 | * |
||
80 | * @param integer $index Point's index. |
||
81 | * @return Point Point object if element with $index value exists. |
||
82 | * @throws CreatorException Method throws exception when point with $index doesn't exists. |
||
83 | */ |
||
84 | public function getPointOrFail($index) |
||
92 | |||
93 | /** |
||
94 | * Method checks that sent Point object collected by current Creator object. |
||
95 | * |
||
96 | * @param Point $point Point object which we want to check. |
||
97 | * @return boolean True if $point isset in $points parameter or false otherwise. |
||
98 | */ |
||
99 | public function searchPoint(Point $point) |
||
103 | } |
||
104 |