1 | <?php |
||
19 | trait NumericParameterTrait |
||
20 | { |
||
21 | /** |
||
22 | * @var array |
||
23 | */ |
||
24 | protected $parameters = array(); |
||
25 | |||
26 | /** |
||
27 | * Assert index in range. |
||
28 | * |
||
29 | * @param int $index |
||
30 | * @param array $parameters |
||
31 | */ |
||
32 | private static function assertBoundRange($index, array $parameters) |
||
38 | |||
39 | /** |
||
40 | * Clear and replace with sets of parameters. |
||
41 | * |
||
42 | * @param array $parameters |
||
43 | * |
||
44 | * @return static |
||
45 | */ |
||
46 | public function replace(array $parameters) |
||
56 | |||
57 | /** |
||
58 | * Add parameter. |
||
59 | * |
||
60 | * @param mixed $parameter |
||
61 | * |
||
62 | * @return static |
||
63 | */ |
||
64 | public function add($parameter) |
||
70 | |||
71 | /** |
||
72 | * Set parameter to specified index. |
||
73 | * |
||
74 | * @param int $index |
||
75 | * @param mixed $parameter |
||
76 | * |
||
77 | * @return static |
||
78 | */ |
||
79 | public function set($index, $parameter) |
||
87 | |||
88 | /** |
||
89 | * Clear all parameters. |
||
90 | * |
||
91 | * @return static |
||
92 | */ |
||
93 | public function clear() |
||
99 | |||
100 | /** |
||
101 | * Get parameter by index. |
||
102 | * |
||
103 | * @param int $index |
||
104 | * |
||
105 | * @return mixed |
||
106 | */ |
||
107 | public function get($index) |
||
113 | |||
114 | /** |
||
115 | * Remove parameter. |
||
116 | * |
||
117 | * @param int $index |
||
118 | * |
||
119 | * @return static |
||
120 | */ |
||
121 | public function remove($index) |
||
129 | |||
130 | /** |
||
131 | * Get all parameters. |
||
132 | * |
||
133 | * @return array |
||
134 | */ |
||
135 | public function all() |
||
139 | } |
||
140 |