Merge pull request #2032 from nextcloud/noodlesegg-refactor

refactoring code to reduce cyclomatic complexit
This commit is contained in:
Roeland Jago Douma 2016-11-07 09:06:09 +01:00 committed by GitHub
commit 25a8d9f543
2 changed files with 5 additions and 10 deletions

View File

@ -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 . '!');
}

View File

@ -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);
}
}