| 1 | <?php |
||
| 10 | class CachedRouteDetector extends RouteDetector |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * Array of cached routes. |
||
| 14 | * |
||
| 15 | * @var string[] |
||
| 16 | */ |
||
| 17 | private $cachedRoutes = array(); |
||
| 18 | |||
| 19 | /** |
||
| 20 | * {@inheritdoc} |
||
| 21 | * @return string |
||
| 22 | */ |
||
| 23 | 12 | public function detect($className) |
|
| 24 | { |
||
| 25 | 12 | if (!empty($this->cachedRoutes[$className])) { |
|
| 26 | 1 | return $this->cachedRoutes[$className]; |
|
| 27 | } |
||
| 28 | 12 | $this->cachedRoutes[$className] = parent::detect($className); |
|
| 29 | |||
| 30 | 12 | return $this->cachedRoutes[$className]; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * {@inheritdoc} |
||
| 35 | */ |
||
| 36 | 8 | public function addRoute($expression, $poolName) |
|
| 45 | |||
| 46 | /** |
||
| 47 | * {@inheritdoc} |
||
| 48 | */ |
||
| 49 | 13 | public function setDefault($route) |
|
| 57 | |||
| 58 | /** |
||
| 59 | * Clear route cache. |
||
| 60 | */ |
||
| 61 | 11 | private function clearCache() |
|
| 65 | } |
||
| 66 |