Merge pull request #1359 from nextcloud/cache_controller_name
Cache the build ControllerName
This commit is contained in:
commit
a7226996f7
|
@ -36,14 +36,25 @@ use OCP\Route\IRouter;
|
||||||
* @package OC\AppFramework\routing
|
* @package OC\AppFramework\routing
|
||||||
*/
|
*/
|
||||||
class RouteConfig {
|
class RouteConfig {
|
||||||
|
/** @var DIContainer */
|
||||||
private $container;
|
private $container;
|
||||||
|
|
||||||
|
/** @var IRouter */
|
||||||
private $router;
|
private $router;
|
||||||
|
|
||||||
|
/** @var array */
|
||||||
private $routes;
|
private $routes;
|
||||||
|
|
||||||
|
/** @var string */
|
||||||
private $appName;
|
private $appName;
|
||||||
|
|
||||||
|
/** @var string[] */
|
||||||
|
private $controllerNameCache = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \OC\AppFramework\DependencyInjection\DIContainer $container
|
* @param \OC\AppFramework\DependencyInjection\DIContainer $container
|
||||||
* @param \OCP\Route\IRouter $router
|
* @param \OCP\Route\IRouter $router
|
||||||
|
* @param array $routes
|
||||||
* @internal param $appName
|
* @internal param $appName
|
||||||
*/
|
*/
|
||||||
public function __construct(DIContainer $container, IRouter $router, $routes) {
|
public function __construct(DIContainer $container, IRouter $router, $routes) {
|
||||||
|
@ -234,7 +245,10 @@ class RouteConfig {
|
||||||
*/
|
*/
|
||||||
private function buildControllerName($controller)
|
private function buildControllerName($controller)
|
||||||
{
|
{
|
||||||
return $this->underScoreToCamelCase(ucfirst($controller)) . 'Controller';
|
if (!isset($this->controllerNameCache[$controller])) {
|
||||||
|
$this->controllerNameCache[$controller] = $this->underScoreToCamelCase(ucfirst($controller)) . 'Controller';
|
||||||
|
}
|
||||||
|
return $this->controllerNameCache[$controller];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue