1 | <?php |
||
23 | class CachingRouter implements RouterInterface |
||
24 | { |
||
25 | /** |
||
26 | * @type CacheItemPoolInterface |
||
27 | */ |
||
28 | private $cache; |
||
29 | |||
30 | /** |
||
31 | * @type int |
||
32 | */ |
||
33 | private $ttl; |
||
34 | |||
35 | /** |
||
36 | * @type RouterInterface |
||
37 | */ |
||
38 | private $router; |
||
39 | |||
40 | /** |
||
41 | * @param CacheItemPoolInterface $cache |
||
42 | * @param RouterInterface $router |
||
43 | * @param array $config |
||
44 | */ |
||
45 | public function __construct(CacheItemPoolInterface $cache, RouterInterface $router, array $config) |
||
51 | |||
52 | /** |
||
53 | * {@inheritdoc} |
||
54 | */ |
||
55 | public function match($pathinfo) |
||
72 | |||
73 | /** |
||
74 | * {@inheritdoc} |
||
75 | */ |
||
76 | public function generate($name, $parameters = [], $referenceType = self::ABSOLUTE_PATH) |
||
93 | |||
94 | /** |
||
95 | * {@inheritdoc} |
||
96 | */ |
||
97 | public function getRouteCollection() |
||
101 | |||
102 | /** |
||
103 | * {@inheritdoc} |
||
104 | */ |
||
105 | public function setContext(RequestContext $context) |
||
109 | |||
110 | /** |
||
111 | * {@inheritdoc} |
||
112 | */ |
||
113 | public function getContext() |
||
117 | |||
118 | /** |
||
119 | * Get a cache item for a call to match(). |
||
120 | * |
||
121 | * @param string $pathinfo |
||
122 | * |
||
123 | * @return \Psr\Cache\CacheItemInterface |
||
124 | */ |
||
125 | private function getCacheItemMatch($pathinfo) |
||
133 | |||
134 | /** |
||
135 | * Get a cache item for a call to generate(). |
||
136 | * |
||
137 | * @param $name |
||
138 | * @param array $parameters |
||
139 | * @param $referenceType |
||
140 | * |
||
141 | * @return \Psr\Cache\CacheItemInterface |
||
142 | */ |
||
143 | private function getCacheItemGenerate($name, array $parameters, $referenceType) |
||
150 | |||
151 | /** |
||
152 | * Passes through all unknown calls onto the router object. |
||
153 | */ |
||
154 | public function __call($method, $args) |
||
158 | |||
159 | /** |
||
160 | * @param string $key |
||
161 | * @param string $tag |
||
162 | * |
||
163 | * @return \Psr\Cache\CacheItemInterface |
||
164 | */ |
||
165 | private function getCacheItemFromKey($key, $tag) |
||
175 | } |
||
176 |