1 | <?php |
||
50 | final class FirstMethodMatchingType |
||
51 | { |
||
52 | use StaticDataCache; |
||
53 | |||
54 | /** |
||
55 | * find a method on a class / object that can accept a given piece of data |
||
56 | * |
||
57 | * @deprecated since 2.12.0 |
||
58 | * |
||
59 | * @param mixed $data |
||
60 | * the data we are looking for |
||
61 | * @param string|object $target |
||
62 | * the class or object that we want to call with $data |
||
63 | * @param string $methodPrefix |
||
64 | * the prefix to put on the front of the method name |
||
65 | * @param string $eUnsupportedType |
||
66 | * the exception to throw if no matching method found |
||
67 | * @return string |
||
68 | * the first method on $target that will accept $data |
||
69 | */ |
||
70 | public static function from($data, $target, $methodPrefix, $eUnsupportedType = E4xx_UnsupportedType::class) |
||
86 | |||
87 | /** |
||
88 | * what key should we use to look up information on $data in our cache? |
||
89 | * |
||
90 | * @param mixed $data |
||
91 | * the data to examine |
||
92 | * @param string|object $target |
||
93 | * the target we want to call |
||
94 | * @return string |
||
95 | * the cache key to use |
||
96 | */ |
||
97 | private static function getCacheName($data, $target) |
||
118 | |||
119 | /** |
||
120 | * do we have an appropriate method in our cache? |
||
121 | * |
||
122 | * @param mixed $data |
||
123 | * the data we want to call $target with |
||
124 | * @param string|object $target |
||
125 | * the target that we want to call |
||
126 | * @return string|null |
||
127 | * the cached method name, or NULL |
||
128 | */ |
||
129 | private static function getMethodFromCache($data, $target) |
||
134 | |||
135 | /** |
||
136 | * remember the method to call for next time |
||
137 | * |
||
138 | * @param mixed $data |
||
139 | * the data we want to call $target with |
||
140 | * @param string|object $target |
||
141 | * the target that we want to call |
||
142 | * @param string $methodName |
||
143 | * the method name that we want to remember |
||
144 | */ |
||
145 | private static function setMethodInCache($data, $target, $methodName) |
||
150 | |||
151 | /** |
||
152 | * which method should we call on $target for $data? |
||
153 | * |
||
154 | * @param mixed $data |
||
155 | * the data we want to call $target with |
||
156 | * @param string|object $target |
||
157 | * the target that we want to call |
||
158 | * @param string $methodPrefix |
||
159 | * the prefix at the front of methods on $target |
||
160 | * @param string $eUnsupportedType |
||
161 | * the exception to throw if no matching method found |
||
162 | * @return string |
||
163 | * the method that suits $data the best |
||
164 | * |
||
165 | * @throws E4xx_UnsupportedType |
||
166 | */ |
||
167 | private static function findMethodToCall($data, $target, $methodPrefix, $eUnsupportedType = E4xx_UnsupportedType::class) |
||
179 | |||
180 | /** |
||
181 | * find the first method on $target that matches $data's data type |
||
182 | * |
||
183 | * @param mixed $data |
||
184 | * the data we want to call $target with |
||
185 | * @param string|object $target |
||
186 | * the target that we want to call |
||
187 | * @param string $methodPrefix |
||
188 | * the prefix at the front of methods on $target |
||
189 | * @return string|null |
||
190 | * the method that suits $data the best |
||
191 | */ |
||
192 | private static function findFirstMatchingMethod($data, $target, $methodPrefix) |
||
209 | |||
210 | /** |
||
211 | * find a method on a class / object that can accept a given piece of data |
||
212 | * |
||
213 | * @deprecated since 2.10.0 |
||
214 | * @codeCoverageIgnore |
||
215 | * @param mixed $data |
||
216 | * the data we are looking for |
||
217 | * @param string|object $target |
||
218 | * the class or object that we want to call with $data |
||
219 | * @param string $methodPrefix |
||
220 | * the prefix to put on the front of the method name |
||
221 | * @param string $eUnsupportedType |
||
222 | * the exception to throw if no matching method found |
||
223 | * @return string |
||
224 | * the first method on $target that will accept $data |
||
225 | */ |
||
226 | public static function fromMixed($data, $target, $methodPrefix, $eUnsupportedType = E4xx_UnsupportedType::class) |
||
230 | |||
231 | /** |
||
232 | * find a method on a class / object that can accept a given piece of data |
||
233 | * |
||
234 | * @param mixed $data |
||
235 | * the data we are looking for |
||
236 | * @param string|object $target |
||
237 | * the class or object that we want to call with $data |
||
238 | * @param string $methodPrefix |
||
239 | * the prefix to put on the front of the method name |
||
240 | * @param string $eUnsupportedType |
||
241 | * the exception to throw if no matching method found |
||
242 | * @return string |
||
243 | * the first method on $target that will accept $data |
||
244 | */ |
||
245 | public function __invoke($data, $target, $methodPrefix, $eUnsupportedType = E4xx_UnsupportedType::class) |
||
249 | } |
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.