1 | <?php |
||
12 | class ParameterFetcherRegistry |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var ParameterFetcher[] |
||
17 | */ |
||
18 | private $parameterFetchers; |
||
19 | |||
20 | /** |
||
21 | * @param ParameterFetcher[] $parameterFetchers |
||
22 | */ |
||
23 | public function __construct(array $parameterFetchers = []) |
||
27 | |||
28 | /** |
||
29 | * Builds a registry with the default fetchers. |
||
30 | * |
||
31 | * @return ParameterFetcherRegistry |
||
32 | */ |
||
33 | public static function buildDefaultControllerRegistry() : ParameterFetcherRegistry |
||
40 | |||
41 | /** |
||
42 | * Adds a parameter fetcher. It will be executed at the top of the list (first). |
||
43 | * |
||
44 | * @param ParameterFetcher $parameterFetcher |
||
45 | * @return ParameterFetcherRegistry |
||
46 | */ |
||
47 | 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 | * @throws SplashException |
||
62 | */ |
||
63 | public function mapParameters(ReflectionMethod $refMethod, string $url = null) : array |
||
86 | |||
87 | /** |
||
88 | * Maps data returned by mapParameters to real arguments to be passed to the action. |
||
89 | * |
||
90 | * @param SplashRequestContext $context |
||
91 | * @param array $parametersMap |
||
92 | * @return array |
||
93 | */ |
||
94 | public function toArguments(SplashRequestContext $context, array $parametersMap) : array |
||
104 | } |