1 | <?php |
||
10 | class ControllerRegistry implements UrlProviderInterface |
||
11 | { |
||
12 | private $controllers; |
||
13 | |||
14 | /** |
||
15 | * @var ControllerDetector |
||
16 | */ |
||
17 | private $controllerDetector; |
||
18 | |||
19 | /** |
||
20 | * @var ControllerAnalyzer |
||
21 | */ |
||
22 | private $controllerAnalyzer; |
||
23 | |||
24 | /** |
||
25 | * Initializes the registry with an array of container instances names. |
||
26 | * |
||
27 | * @param ControllerAnalyzer $controllerAnalyzer |
||
28 | * @param string[] $controllers An array of controller instance name (as declared in the container) |
||
29 | * @param ControllerDetector $controllerDetector |
||
30 | */ |
||
31 | public function __construct(ControllerAnalyzer $controllerAnalyzer, array $controllers = [], ControllerDetector $controllerDetector = null) |
||
38 | |||
39 | /** |
||
40 | * Adds a container to the registry (by its instance name). |
||
41 | * Note: any object that has a \@Action or \@URL annotation is a controller. |
||
42 | * |
||
43 | * @param string $controller |
||
44 | * |
||
45 | * @return ControllerRegistry |
||
46 | */ |
||
47 | public function addController(string $controller) : ControllerRegistry |
||
53 | |||
54 | /** |
||
55 | * Returns the list of URLs that can be accessed, and the function/method that should be called when the URL is called. |
||
56 | * |
||
57 | * @param string $instanceName The identifier for this object in the container. |
||
58 | * |
||
59 | * @return SplashRoute[] |
||
60 | * |
||
61 | * @throws \Mouf\Mvc\Splash\Utils\SplashException |
||
62 | */ |
||
63 | public function getUrlsList($instanceName) |
||
85 | |||
86 | /** |
||
87 | * Returns a unique tag representing the list of SplashRoutes returned. |
||
88 | * If the tag changes, the cache is flushed by Splash. |
||
89 | * |
||
90 | * Important! This must be quick to compute. |
||
91 | * |
||
92 | * @return mixed |
||
93 | */ |
||
94 | public function getExpirationTag() : string |
||
99 | } |
||
100 |