'', 'valid' => false ]; try { $token = $apiService->getKey($request); $output['token'] = $token; if (!str_contains($token, $loginService->getSeparator())) { throw new EmptyResult('Token not complex'); } list($key, $selector, $token) = explode($loginService->getSeparator(), $token, 3); $output['valid'] = $loginService->isIn($selector, $token); } catch (MissingAuthorizationHeader | EmptyResult) {} return $this->withJson($response, $output); } }