From 4fe62ea248dc077fa1fb3bb0cc2e84a563af3c92 Mon Sep 17 00:00:00 2001 From: Marco Vito Moscaritolo Date: Sun, 31 May 2015 17:39:52 +0200 Subject: [PATCH] Fixed PHPCS. --- PHPCI/Application.php | 19 +++++++++++++++---- PHPCI/Controller/BuildController.php | 3 +-- PHPCI/Controller/BuildStatusController.php | 3 +-- PHPCI/Controller/HomeController.php | 3 +-- PHPCI/Controller/ProjectController.php | 3 +-- PHPCI/Controller/SessionController.php | 3 +-- PHPCI/Controller/UserController.php | 3 +-- PHPCI/Controller/WebhookController.php | 3 +-- 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/PHPCI/Application.php b/PHPCI/Application.php index 9b7fec03..9f2cc86e 100644 --- a/PHPCI/Application.php +++ b/PHPCI/Application.php @@ -58,8 +58,7 @@ class Application extends b8\Application UserStore $userStore, ProjectStore $projectStore, Container $container - ) - { + ) { $this->config = $config; $this->response = $response; $this->request = $request; @@ -165,7 +164,7 @@ class Application extends b8\Application public function getController() { if (empty($this->controller)) { - $this->controller = $this->container->get('application.controller.' . strtolower($this->route['controller'])); + $this->controller = $this->container->get($this->getControllerId($this->route)); } return $this->controller; @@ -180,7 +179,19 @@ class Application extends b8\Application */ public function controllerExists($route) { - return $this->container->has('application.controller.' . strtolower($route['controller'])); + return $this->container->has($this->getControllerId($route)); + } + + /** + * Create controller service Id based on specified route. + * + * @param array $route + * + * @return string + */ + protected function getControllerId($route) + { + return 'application.controller.' . strtolower($route['controller']); } /** diff --git a/PHPCI/Controller/BuildController.php b/PHPCI/Controller/BuildController.php index 6d47ec7a..80c84420 100644 --- a/PHPCI/Controller/BuildController.php +++ b/PHPCI/Controller/BuildController.php @@ -56,8 +56,7 @@ class BuildController extends \PHPCI\Controller Response $response, BuildStore $buildStore, BuildService $buildService - ) - { + ) { parent::__construct($config, $request, $response); $this->buildStore = $buildStore; diff --git a/PHPCI/Controller/BuildStatusController.php b/PHPCI/Controller/BuildStatusController.php index 85cb4f49..98e3280b 100644 --- a/PHPCI/Controller/BuildStatusController.php +++ b/PHPCI/Controller/BuildStatusController.php @@ -61,8 +61,7 @@ class BuildStatusController extends \PHPCI\Controller BuildStore $buildStore, ProjectStore $projectStore, HttpClient $shieldsClient - ) - { + ) { parent::__construct($config, $request, $response); $this->buildStore = $buildStore; diff --git a/PHPCI/Controller/HomeController.php b/PHPCI/Controller/HomeController.php index 97831bbc..31f51554 100644 --- a/PHPCI/Controller/HomeController.php +++ b/PHPCI/Controller/HomeController.php @@ -52,8 +52,7 @@ class HomeController extends \PHPCI\Controller Response $response, BuildStore $buildStore, ProjectStore $projectStore - ) - { + ) { parent::__construct($config, $request, $response); $this->buildStore = $buildStore; diff --git a/PHPCI/Controller/ProjectController.php b/PHPCI/Controller/ProjectController.php index 9005b03b..a339e5d8 100644 --- a/PHPCI/Controller/ProjectController.php +++ b/PHPCI/Controller/ProjectController.php @@ -73,8 +73,7 @@ class ProjectController extends PHPCI\Controller ProjectStore $projectStore, ProjectService $projectService, BuildService $buildService - ) - { + ) { parent::__construct($config, $request, $response); $this->buildStore = $buildStore; diff --git a/PHPCI/Controller/SessionController.php b/PHPCI/Controller/SessionController.php index c38d59ee..0e401b58 100644 --- a/PHPCI/Controller/SessionController.php +++ b/PHPCI/Controller/SessionController.php @@ -43,8 +43,7 @@ class SessionController extends \PHPCI\Controller Request $request, Response $response, UserStore $userStore, - ) - { + ) { parent::__construct($config, $request, $response); $this->response->disableLayout(); diff --git a/PHPCI/Controller/UserController.php b/PHPCI/Controller/UserController.php index 3b5578b4..3e99beba 100644 --- a/PHPCI/Controller/UserController.php +++ b/PHPCI/Controller/UserController.php @@ -53,8 +53,7 @@ class UserController extends Controller Response $response, UserStore $userStore, UserService $userService - ) - { + ) { parent::__construct($config, $request, $response); $this->userStore = $userStore; diff --git a/PHPCI/Controller/WebhookController.php b/PHPCI/Controller/WebhookController.php index cd94564c..975b1203 100644 --- a/PHPCI/Controller/WebhookController.php +++ b/PHPCI/Controller/WebhookController.php @@ -65,8 +65,7 @@ class WebhookController extends \b8\Controller BuildStore $buildStore, ProjectStore $projectStore, BuildService $buildService - ) - { + ) { parent::__construct($config, $request, $response); $this->buildStore = $buildStore;