1 | <?php |
||
11 | class Parameters extends Hash |
||
12 | { |
||
13 | /** |
||
14 | * If new created params should throw exceptions or ignore unpermitted params |
||
15 | * @var boolean |
||
16 | */ |
||
17 | public static $throwExceptions = true; |
||
18 | |||
19 | /** |
||
20 | * If should throw exceptions or ignore unpermitted params |
||
21 | * @var boolean |
||
22 | */ |
||
23 | protected $throw = true; |
||
24 | |||
25 | /** |
||
26 | * Makes sure a parameter was passed |
||
27 | * |
||
28 | * @param string $key the parameter key |
||
29 | * @return Parameters |
||
30 | * @throws ParameterMissingException when parameter is missing |
||
31 | */ |
||
32 | public function requireParam($key) |
||
44 | |||
45 | /** |
||
46 | * Filters unwanted params |
||
47 | * @param array $permittedParams |
||
48 | * @return Parameters |
||
49 | * @throws UnpermittedParameterException when parameters are set to throw |
||
50 | * exception on unpermitted params |
||
51 | */ |
||
52 | public function permit(array $permittedParams) |
||
60 | |||
61 | /** |
||
62 | * Filter out or throws exception according to the permitted params |
||
63 | * @param Parameter $params |
||
64 | * @param array $permitted |
||
65 | * @throws UnpermittedParameterException when params not permitted are passed in |
||
66 | */ |
||
67 | public function filter(Parameters $params, array $permitted = array()) |
||
73 | |||
74 | /** |
||
75 | * Handle Parameters that have only integer indexes |
||
76 | * @param Parameter $params |
||
77 | * @param array $permitted |
||
78 | */ |
||
79 | private function handleCollections(Parameters $params, array $permitted = array()) |
||
101 | |||
102 | /** |
||
103 | * Handle permissions that are given in the hash form |
||
104 | * @param Parameter $params |
||
105 | * @param array $permitted |
||
106 | */ |
||
107 | private function handleArrays(Parameters $params, array $permitted = array()) |
||
121 | |||
122 | /** |
||
123 | * Filters out or throws exception when parameters are neigher keys nor values |
||
124 | * in the permitted array |
||
125 | * @param Parameter $params |
||
126 | * @param array $permitted |
||
127 | * @throws ParameterMissingException when parameter is missing |
||
128 | */ |
||
129 | private function cleanUnwanted(Parameters $params, $permitted) |
||
141 | |||
142 | /** |
||
143 | * Get the flag throw |
||
144 | * |
||
145 | * @return boolean; |
||
146 | */ |
||
147 | public function getThrowExceptions() |
||
151 | |||
152 | /** |
||
153 | * Empty Hash or empty array? |
||
154 | * @return boolean |
||
155 | */ |
||
156 | protected function valueIsEmpty($value) |
||
164 | |||
165 | /** |
||
166 | * Handle the unpermitted param either by removing it or throwing an exception |
||
167 | * @param string $key |
||
168 | * @param Parameters $params |
||
169 | * @throws ParameterMissingException when parameter is missing |
||
170 | */ |
||
171 | protected function handleUnpermittedParam($key, $params) |
||
180 | } |
||
181 |
This method has been deprecated. The supplier of the class has supplied an explanatory message.
The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.