diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2016-11-07 09:06:09 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-11-07 09:06:09 +0100 |
commit | 25a8d9f543e34311c17534e7f7fc0b81ffd47169 (patch) | |
tree | 7926d6b73a75dfd97de2a72b6767fbed1b7dd488 | |
parent | 8d954c0ecebd07e4732d2ae8abfdf0135695d28c (diff) | |
parent | 537d588726f0ddc1a3a0327156912a0ec4089abb (diff) | |
download | nextcloud-server-25a8d9f543e34311c17534e7f7fc0b81ffd47169.tar.gz nextcloud-server-25a8d9f543e34311c17534e7f7fc0b81ffd47169.zip |
Merge pull request #2032 from nextcloud/noodlesegg-refactor
refactoring code to reduce cyclomatic complexit
-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); } } |