refactoring code to reduce cyclomatic complexit
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
parent
8d954c0ece
commit
537d588726
|
@ -92,9 +92,8 @@ abstract class Controller {
|
||||||
}
|
}
|
||||||
$response->setHeaders(array_merge($dataHeaders, $headers));
|
$response->setHeaders(array_merge($dataHeaders, $headers));
|
||||||
return $response;
|
return $response;
|
||||||
} else {
|
|
||||||
return new JSONResponse($data);
|
|
||||||
}
|
}
|
||||||
|
return new JSONResponse($data);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -153,10 +152,9 @@ abstract class Controller {
|
||||||
|
|
||||||
return $responder($response);
|
return $responder($response);
|
||||||
|
|
||||||
} else {
|
|
||||||
throw new \DomainException('No responder registered for format ' .
|
|
||||||
$format . '!');
|
|
||||||
}
|
}
|
||||||
|
throw new \DomainException('No responder registered for format '.
|
||||||
|
$format . '!');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -106,12 +106,9 @@ abstract class OCSController extends ApiController {
|
||||||
*/
|
*/
|
||||||
private function buildOCSResponse($format, DataResponse $data) {
|
private function buildOCSResponse($format, DataResponse $data) {
|
||||||
if ($this->ocsVersion === 1) {
|
if ($this->ocsVersion === 1) {
|
||||||
$response = new \OC\AppFramework\OCS\V1Response($data, $format);
|
return new \OC\AppFramework\OCS\V1Response($data, $format);
|
||||||
} else {
|
|
||||||
$response = new \OC\AppFramework\OCS\V2Response($data, $format);
|
|
||||||
}
|
}
|
||||||
|
return new \OC\AppFramework\OCS\V2Response($data, $format);
|
||||||
return $response;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue