Commit a3ef3bdf authored by Oliver Bartsch's avatar Oliver Bartsch
Browse files

Apply php-cs-fixer

parent b0ee2fef
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Controller\Api;
......@@ -47,7 +47,7 @@ abstract class AbstractApiController implements RequestHandlerInterface
if (!($request->getAttribute('routing') instanceof RouteResultArguments)) {
return $this->apiResponseFactory
->createErrorResponseForRequest($request,1600994285, 'Route arguments are invalid');
->createErrorResponseForRequest($request, 1600994285, 'Route arguments are invalid');
}
$this->routeResultArguments = $request->getAttribute('routing');
......@@ -90,4 +90,4 @@ abstract class AbstractApiController implements RequestHandlerInterface
return $invalidArguments;
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Controller\Api;
......@@ -73,4 +73,4 @@ final class ExtensionController extends AbstractApiController
{
return $this->apiResponseFactory->createResponseForRequest($this->request, ['handler' => __METHOD__]);
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Controller\Api;
......@@ -28,4 +28,4 @@ final class OauthController extends AbstractApiController
{
return $this->apiResponseFactory->createResponseForRequest($this->request, ['handler' => __METHOD__]);
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Controller\Api;
......@@ -26,4 +26,4 @@ final class PingController extends AbstractApiController
['endpoints' => array_keys($this->routeConfiguration->getSchema()['paths'] ?? [])]
);
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
/*
* This file is part of TYPO3 CMS-extension "ter", created by Oliver Bartsch.
......@@ -16,8 +16,8 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use T3o\Ter\Rest\RouteHandler;
use T3o\Ter\Rest\RouteConfiguration;
use T3o\Ter\Rest\RouteHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
......
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest;
......
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\Response;
......@@ -118,4 +118,4 @@ final class ApiResponseFactory
$response->withHeader($header, (string)$value);
}
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -79,4 +79,4 @@ abstract class AbstractRouteArgument implements RouteArgumentInterface, \JsonSer
'validationErrors' => $validationErrorMessages
];
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -18,4 +18,4 @@ namespace T3o\Ter\Rest\RouteArgument;
interface DeepObjectRouteArgumentInterface
{
public function getProperties(): array;
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -49,4 +49,4 @@ class IntegerArgument extends AbstractRouteArgument
$this->validators[EnumValidator::class] = [$this->configuration['schema']['enum']];
}
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -49,4 +49,4 @@ class ObjectArgument extends AbstractRouteArgument implements DeepObjectRouteArg
{
return $this->properties;
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -42,4 +42,4 @@ final class RouteArgumentFactory
$className = $this->availableRouteArguments[$type];
return GeneralUtility::makeInstance($className, $name, $configuration, $value);
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -28,4 +28,4 @@ interface RouteArgumentInterface
public function getValidationErrors(): array;
public function jsonSerialize(): array;
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\RouteArgument;
......@@ -54,4 +54,4 @@ class StringArgument extends AbstractRouteArgument
$this->validators[PatternValidator::class] = [$this->configuration['schema']['pattern']];
}
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest;
......
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest;
......@@ -54,9 +54,9 @@ final class RouteHandler implements RequestHandlerInterface
$request = $request->withAttribute('routing', $routeResultArguments);
} catch (MethodNotAllowedException $e) {
$message = 'The method ' . $request->getMethod() . ' is not allowed.';
return $this->apiResponseFactory->createErrorResponseForRequest($request,1600994273, $message, 405);
return $this->apiResponseFactory->createErrorResponseForRequest($request, 1600994273, $message, 405);
} catch (ResourceNotFoundException|\OutOfRangeException|\InvalidArgumentException $e) {
return $this->apiResponseFactory->createErrorResponseForRequest($request,1601289397, $e->getMessage());
return $this->apiResponseFactory->createErrorResponseForRequest($request, 1601289397, $e->getMessage());
}
// @todo Implement rate limit check here for early return
......
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest;
......@@ -45,8 +45,8 @@ final class RouteResolver
{
$resultParameters = (new UrlMatcher(
$this->routeConfiguration->getRouteCollection(),
$this->getRequestContext($request))
)->match($this->routeConfiguration->getEndpoint($request->getUri()->getPath()));
$this->getRequestContext($request)
))->match($this->routeConfiguration->getEndpoint($request->getUri()->getPath()));
if (!($resultParameters['_route'] ?? false)) {
throw new ResourceNotFoundException('No resource found for the given route.', 1600994133);
......@@ -63,7 +63,7 @@ final class RouteResolver
);
$arguments = array_merge(
array_filter($resultParameters, static function($_, $k){
array_filter($resultParameters, static function ($_, $k){
return strpos($k, '_') !== 0;
}, ARRAY_FILTER_USE_BOTH),
$request->getQueryParams()
......@@ -79,7 +79,7 @@ final class RouteResolver
return $routeResultArguments;
}
protected function getRequestContext(ServerRequestInterface $request): RequestContext
protected function getRequestContext(ServerRequestInterface $request): RequestContext
{
$uri = $request->getUri();
return new RequestContext(
......@@ -93,4 +93,4 @@ final class RouteResolver
$uri->getQuery()
);
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest;
......
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\Validaton;
......@@ -43,4 +43,4 @@ final class EnumValidator implements ValidatorInterface
);
}
}
}
\ No newline at end of file
}
<?php
declare(strict_types=1);
declare(strict_types = 1);
namespace T3o\Ter\Rest\Validaton;
......@@ -57,4 +57,4 @@ final class MaxValidator implements ValidatorInterface
);
}
}
}
\ No newline at end of file
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment