lint: apply phpcbf to application/
Signed-off-by: VirtualTam <virtualtam@flibidi.net>
This commit is contained in:
parent
04ec8fedd9
commit
f211e417bf
23 changed files with 98 additions and 93 deletions
application/api
|
@ -65,7 +65,7 @@ class ApiMiddleware
|
|||
try {
|
||||
$this->checkRequest($request);
|
||||
$response = $next($request, $response);
|
||||
} catch(ApiException $e) {
|
||||
} catch (ApiException $e) {
|
||||
$e->setResponse($response);
|
||||
$e->setDebug($this->conf->get('dev.debug', false));
|
||||
$response = $e->getApiResponse();
|
||||
|
@ -98,7 +98,8 @@ class ApiMiddleware
|
|||
*
|
||||
* @throws ApiAuthorizationException The token couldn't be validated.
|
||||
*/
|
||||
protected function checkToken($request) {
|
||||
protected function checkToken($request)
|
||||
{
|
||||
if (! $request->hasHeader('Authorization')) {
|
||||
throw new ApiAuthorizationException('JWT token not provided');
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ abstract class ApiController
|
|||
|
||||
/**
|
||||
* ApiController constructor.
|
||||
*
|
||||
*
|
||||
* Note: enabling debug mode displays JSON with readable formatting.
|
||||
*
|
||||
* @param Container $ci Slim container.
|
||||
|
|
|
@ -35,8 +35,7 @@ class History extends ApiController
|
|||
$offset = $request->getParam('offset');
|
||||
if (empty($offset)) {
|
||||
$offset = 0;
|
||||
}
|
||||
elseif (ctype_digit($offset)) {
|
||||
} elseif (ctype_digit($offset)) {
|
||||
$offset = (int) $offset;
|
||||
} else {
|
||||
throw new ApiBadParametersException('Invalid offset');
|
||||
|
|
|
@ -7,7 +7,7 @@ use Slim\Http\Response;
|
|||
|
||||
/**
|
||||
* Class Info
|
||||
*
|
||||
*
|
||||
* REST API Controller: /info
|
||||
*
|
||||
* @package Api\Controllers
|
||||
|
@ -17,7 +17,7 @@ class Info extends ApiController
|
|||
{
|
||||
/**
|
||||
* Service providing various information about Shaarli instance.
|
||||
*
|
||||
*
|
||||
* @param Request $request Slim request.
|
||||
* @param Response $response Slim response.
|
||||
*
|
||||
|
|
|
@ -10,7 +10,8 @@ use Slim\Http\Response;
|
|||
* Parent Exception related to the API, able to generate a valid Response (ResponseInterface).
|
||||
* Also can include various information in debug mode.
|
||||
*/
|
||||
abstract class ApiException extends \Exception {
|
||||
abstract class ApiException extends \Exception
|
||||
{
|
||||
|
||||
/**
|
||||
* @var Response instance from Slim.
|
||||
|
@ -27,7 +28,7 @@ abstract class ApiException extends \Exception {
|
|||
*
|
||||
* @return Response Final response to give.
|
||||
*/
|
||||
public abstract function getApiResponse();
|
||||
abstract public function getApiResponse();
|
||||
|
||||
/**
|
||||
* Creates ApiResponse body.
|
||||
|
@ -36,7 +37,8 @@ abstract class ApiException extends \Exception {
|
|||
*
|
||||
* @return array|string response body
|
||||
*/
|
||||
protected function getApiResponseBody() {
|
||||
protected function getApiResponseBody()
|
||||
{
|
||||
if ($this->debug !== true) {
|
||||
return $this->getMessage();
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Shaarli\Api\Exceptions;
|
||||
|
||||
|
||||
use Slim\Http\Response;
|
||||
|
||||
/**
|
||||
|
|
|
@ -2,7 +2,6 @@
|
|||
|
||||
namespace Shaarli\Api\Exceptions;
|
||||
|
||||
|
||||
use Slim\Http\Response;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue