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