|
@@ 138-142 (lines=5) @@
|
| 135 |
|
*/ |
| 136 |
|
private function checkAuth(ApiAuthorizationInterface $authorization) |
| 137 |
|
{ |
| 138 |
|
if (!$authorization->authorized()) { |
| 139 |
|
$this->getHttpResponse()->setCode(Response::S403_FORBIDDEN); |
| 140 |
|
$this->sendResponse(new JsonResponse(['status' => 'error', 'message' => $authorization->getErrorMessage()])); |
| 141 |
|
return false; |
| 142 |
|
} |
| 143 |
|
return true; |
| 144 |
|
} |
| 145 |
|
|
|
@@ 156-160 (lines=5) @@
|
| 153 |
|
private function processParams(ApiHandlerInterface $handler) |
| 154 |
|
{ |
| 155 |
|
$paramsProcessor = new ParamsProcessor($handler->params()); |
| 156 |
|
if ($paramsProcessor->isError()) { |
| 157 |
|
$this->getHttpResponse()->setCode(Response::S500_INTERNAL_SERVER_ERROR); |
| 158 |
|
$this->sendResponse(new JsonResponse(['status' => 'error', 'message' => 'wrong input'])); |
| 159 |
|
return false; |
| 160 |
|
} |
| 161 |
|
return $paramsProcessor->getValues(); |
| 162 |
|
} |
| 163 |
|
|