[Pkg-owncloud-commits] [owncloud] 103/134: Remove dependency on container, removing service locator antipattern

David Prévot taffit at moszumanska.debian.org
Fri Apr 18 21:44:06 UTC 2014


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch master
in repository owncloud.

commit 6b15731bfea62c0537bc0d3c3b58e589bf9c9212
Author: Bernhard Posselt <Raydiation at users.noreply.github.com>
Date:   Wed Apr 2 17:54:33 2014 +0200

    Remove dependency on container, removing service locator antipattern
---
 lib/public/appframework/controller.php | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php
index dc8da96..81dc568 100644
--- a/lib/public/appframework/controller.php
+++ b/lib/public/appframework/controller.php
@@ -38,10 +38,10 @@ use OCP\IRequest;
 abstract class Controller {
 
 	/**
-	 * app container for dependency injection
-	 * @var \OCP\AppFramework\IAppContainer
+	 * app name
+	 * @var string
 	 */
-	protected $app;
+	protected $appName;
 
 	/**
 	 * current request
@@ -51,11 +51,11 @@ abstract class Controller {
 
 	/**
 	 * constructor of the controller
-	 * @param IAppContainer $app interface to the app
+	 * @param string $appName the name of the app
 	 * @param IRequest $request an instance of the request
 	 */
-	public function __construct(IAppContainer $app, IRequest $request){
-		$this->app = $app;
+	public function __construct($appName, IRequest $request){
+		$this->appName = $appName;
 		$this->request = $request;
 	}
 
@@ -136,7 +136,7 @@ abstract class Controller {
 	 */
 	public function render($templateName, array $params=array(),
 							$renderAs='user', array $headers=array()){
-		$response = new TemplateResponse($this->app->getAppName(), $templateName);
+		$response = new TemplateResponse($this->appName, $templateName);
 		$response->setParams($params);
 		$response->renderAs($renderAs);
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list