diff options
author | Joas Schilling <coding@schilljs.com> | 2016-09-12 14:26:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-12 14:26:51 +0200 |
commit | a7226996f7f5dc05b820c7f6d16cc8e3dbb2af2d (patch) | |
tree | 60aa1fc1211b32eb1f95f8429593c613b3c76c05 | |
parent | cf57055960489bf3c2d22db38b39452033f37d59 (diff) | |
parent | 959bf0d1a7fd1d7a66ae015ffd86807f328f274e (diff) | |
download | nextcloud-server-a7226996f7f5dc05b820c7f6d16cc8e3dbb2af2d.tar.gz nextcloud-server-a7226996f7f5dc05b820c7f6d16cc8e3dbb2af2d.zip |
Merge pull request #1359 from nextcloud/cache_controller_name
Cache the build ControllerName
-rw-r--r-- | lib/private/AppFramework/Routing/RouteConfig.php | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/private/AppFramework/Routing/RouteConfig.php b/lib/private/AppFramework/Routing/RouteConfig.php index e94f2e50c1d..70208725f46 100644 --- a/lib/private/AppFramework/Routing/RouteConfig.php +++ b/lib/private/AppFramework/Routing/RouteConfig.php @@ -36,14 +36,25 @@ use OCP\Route\IRouter; * @package OC\AppFramework\routing */ class RouteConfig { + /** @var DIContainer */ private $container; + + /** @var IRouter */ private $router; + + /** @var array */ private $routes; + + /** @var string */ private $appName; + /** @var string[] */ + private $controllerNameCache = []; + /** * @param \OC\AppFramework\DependencyInjection\DIContainer $container * @param \OCP\Route\IRouter $router + * @param array $routes * @internal param $appName */ public function __construct(DIContainer $container, IRouter $router, $routes) { @@ -234,7 +245,10 @@ class RouteConfig { */ 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]; } /** |