diff options
author | Donquixote <marjunebatac@gmailcom> | 2016-10-29 18:00:01 +0800 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-11-07 08:18:16 +0100 |
commit | 537d588726f0ddc1a3a0327156912a0ec4089abb (patch) | |
tree | 7926d6b73a75dfd97de2a72b6767fbed1b7dd488 /lib/public | |
parent | 8d954c0ecebd07e4732d2ae8abfdf0135695d28c (diff) | |
download | nextcloud-server-537d588726f0ddc1a3a0327156912a0ec4089abb.tar.gz nextcloud-server-537d588726f0ddc1a3a0327156912a0ec4089abb.zip |
refactoring code to reduce cyclomatic complexit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/AppFramework/Controller.php | 8 | ||||
-rw-r--r-- | lib/public/AppFramework/OCSController.php | 7 |
2 files changed, 5 insertions, 10 deletions
diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php index f730799bece..9fb7646e1ae 100644 --- a/lib/public/AppFramework/Controller.php +++ b/lib/public/AppFramework/Controller.php @@ -92,9 +92,8 @@ abstract class Controller { } $response->setHeaders(array_merge($dataHeaders, $headers)); return $response; - } else { - return new JSONResponse($data); } + return new JSONResponse($data); } ); } @@ -153,10 +152,9 @@ abstract class Controller { return $responder($response); - } else { - throw new \DomainException('No responder registered for format ' . - $format . '!'); } + throw new \DomainException('No responder registered for format '. + $format . '!'); } diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index 5f18ba0807a..9b3b12e2b94 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -106,12 +106,9 @@ abstract class OCSController extends ApiController { */ private function buildOCSResponse($format, DataResponse $data) { if ($this->ocsVersion === 1) { - $response = new \OC\AppFramework\OCS\V1Response($data, $format); - } else { - $response = new \OC\AppFramework\OCS\V2Response($data, $format); + return new \OC\AppFramework\OCS\V1Response($data, $format); } - - return $response; + return new \OC\AppFramework\OCS\V2Response($data, $format); } } |