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