diff options
author | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-05-29 19:14:47 +0200 |
---|---|---|
committer | Bernhard Posselt <dev@bernhard-posselt.com> | 2014-06-05 18:00:36 +0200 |
commit | 587a8df5668cca01cd7d928160661df583d5a7fe (patch) | |
tree | 9a4f3b46a33b82515d52a785260605aac2bfec2a /lib | |
parent | 1c598085176e4bef12f5fbcd221ef6b832b734bb (diff) | |
download | nextcloud-server-587a8df5668cca01cd7d928160661df583d5a7fe.tar.gz nextcloud-server-587a8df5668cca01cd7d928160661df583d5a7fe.zip |
remove controller serializers
Diffstat (limited to 'lib')
-rw-r--r-- | lib/public/appframework/controller.php | 23 | ||||
-rw-r--r-- | lib/public/appframework/http/iresponseserializer.php | 27 |
2 files changed, 3 insertions, 47 deletions
diff --git a/lib/public/appframework/controller.php b/lib/public/appframework/controller.php index 96ab5e75e82..79491902bfd 100644 --- a/lib/public/appframework/controller.php +++ b/lib/public/appframework/controller.php @@ -29,7 +29,6 @@ namespace OCP\AppFramework; use OCP\AppFramework\Http\TemplateResponse; use OCP\AppFramework\Http\JSONResponse; -use OCP\AppFramework\Http\IResponseSerializer; use OCP\IRequest; @@ -50,7 +49,6 @@ abstract class Controller { */ protected $request; - private $serializer; private $responders; /** @@ -58,7 +56,7 @@ abstract class Controller { * @param string $appName the name of the app * @param IRequest $request an instance of the request */ - public function __construct($appName, + public function __construct($appName, IRequest $request){ $this->appName = $appName; $this->request = $request; @@ -72,17 +70,6 @@ abstract class Controller { } - /** - * Registers a serializer that is executed before a formatter is being - * called, useful for turning any data into PHP arrays that can be used - * by a JSONResponse for instance - * @param IResponseSerializer $serializer - */ - protected function registerSerializer(IResponseSerializer $serializer) { - $this->serializer = $serializer; - } - - /** * Registers a formatter for a type * @param string $format @@ -104,16 +91,12 @@ abstract class Controller { public function buildResponse($response, $format='json') { if(array_key_exists($format, $this->responders)) { - if ($this->serializer) { - $response = $this->serializer->serialize($response); - } - $responder = $this->responders[$format]; - + return $responder($response); } else { - throw new \DomainException('No responder registered for format ' . + throw new \DomainException('No responder registered for format ' . $format . '!'); } } diff --git a/lib/public/appframework/http/iresponseserializer.php b/lib/public/appframework/http/iresponseserializer.php deleted file mode 100644 index c16e106df34..00000000000 --- a/lib/public/appframework/http/iresponseserializer.php +++ /dev/null @@ -1,27 +0,0 @@ -<?php -/** - * ownCloud - App Framework - * - * @author Bernhard Posselt - * @copyright 2012 Bernhard Posselt <dev@bernhard-posselt.com> - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE - * License as published by the Free Software Foundation; either - * version 3 of the License, or any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU AFFERO GENERAL PUBLIC LICENSE for more details. - * - * You should have received a copy of the GNU Affero General Public - * License along with this library. If not, see <http://www.gnu.org/licenses/>. - * - */ - -namespace OCP\AppFramework\Http; - -interface IResponseSerializer { - function serialize($response); -}
\ No newline at end of file |