1 | <?php |
||
11 | class ParameterFetcherRegistry |
||
12 | { |
||
13 | /** |
||
14 | * @var ParameterFetcher[] |
||
15 | */ |
||
16 | private $parameterFetchers; |
||
17 | |||
18 | /** |
||
19 | * @param ParameterFetcher[] $parameterFetchers |
||
20 | */ |
||
21 | public function __construct(array $parameterFetchers = []) |
||
25 | |||
26 | /** |
||
27 | * Builds a registry with the default fetchers. |
||
28 | * |
||
29 | * @return ParameterFetcherRegistry |
||
30 | */ |
||
31 | public static function buildDefaultControllerRegistry() : ParameterFetcherRegistry |
||
38 | |||
39 | /** |
||
40 | * Adds a parameter fetcher. It will be executed at the top of the list (first). |
||
41 | * |
||
42 | * @param ParameterFetcher $parameterFetcher |
||
43 | * |
||
44 | * @return ParameterFetcherRegistry |
||
45 | */ |
||
46 | public function registerParameterFetcher(ParameterFetcher $parameterFetcher) : ParameterFetcherRegistry |
||
52 | |||
53 | /** |
||
54 | * Analyses the method and returns an array of SplashRequestParameterFetcher. |
||
55 | * Note: the return from this method is meant to be cached. |
||
56 | * |
||
57 | * @param ReflectionMethod $refMethod |
||
58 | * @param string $url |
||
59 | * |
||
60 | * @return array[] An array representing serializable fetchers. Each fetcher is represented as an array with 2 keys: "fetcherId" (an ID for the fetcher) and "data" (data required by the fetcher) |
||
61 | * |
||
62 | * @throws SplashException |
||
63 | */ |
||
64 | public function mapParameters(ReflectionMethod $refMethod, string $url = null) : array |
||
87 | |||
88 | /** |
||
89 | * Maps data returned by mapParameters to real arguments to be passed to the action. |
||
90 | * |
||
91 | * @param SplashRequestContext $context |
||
92 | * @param array $parametersMap |
||
93 | * |
||
94 | * @return array |
||
95 | */ |
||
96 | public function toArguments(SplashRequestContext $context, array $parametersMap) : array |
||
107 | } |
||
108 |