diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-09 10:03:16 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2016-08-10 12:40:26 +0200 |
commit | 1f370c97ed482a2217b49c949e93436d07f83157 (patch) | |
tree | 2db9c7e0c30bbd9fc5a02e00f58d04cd1d645520 /lib/public | |
parent | cdb574ca264759b5571284621fc4970af895767d (diff) | |
download | nextcloud-server-1f370c97ed482a2217b49c949e93436d07f83157.tar.gz nextcloud-server-1f370c97ed482a2217b49c949e93436d07f83157.zip |
OCSController requires DataResponse
The OCS Controller requires a DataResponse object to be returned.
This means that all error handling will have to be done via exceptions
thrown and handling in the middleware.
Diffstat (limited to 'lib/public')
-rw-r--r-- | lib/public/AppFramework/OCSController.php | 15 |
1 files changed, 4 insertions, 11 deletions
diff --git a/lib/public/AppFramework/OCSController.php b/lib/public/AppFramework/OCSController.php index bd50f0a4017..6036fc6a5a8 100644 --- a/lib/public/AppFramework/OCSController.php +++ b/lib/public/AppFramework/OCSController.php @@ -88,26 +88,19 @@ abstract class OCSController extends ApiController { /** * Unwrap data and build ocs response * @param string $format json or xml - * @param array|DataResponse $data the data which should be transformed + * @param DataResponse $data the data which should be transformed * @since 8.1.0 + * @return OCSResponse */ - private function buildOCSResponse($format, $data) { - if ($data instanceof DataResponse) { - $data = $data->getData(); - } - + private function buildOCSResponse($format, DataResponse $data) { $params = [ 'statuscode' => 100, 'message' => 'OK', - 'data' => [], + 'data' => $data->getData(), 'itemscount' => '', 'itemsperpage' => '' ]; - foreach ($data as $key => $value) { - $params[$key] = $value; - } - return new OCSResponse( $format, $params['statuscode'], $params['message'], $params['data'], |