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