Renamed ShortUrlInputFilter and added named constructors to it

This commit is contained in:
Alejandro Celaya
2021-01-31 07:44:46 +01:00
parent 08f4a424e6
commit 7e90fd45a7
13 changed files with 99 additions and 92 deletions

View File

@@ -8,7 +8,7 @@ use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\MiddlewareInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Shlinkio\Shlink\Core\Validation\ShortUrlMetaInputFilter;
use Shlinkio\Shlink\Core\Validation\ShortUrlInputFilter;
class DefaultShortCodesLengthMiddleware implements MiddlewareInterface
{
@@ -22,8 +22,8 @@ class DefaultShortCodesLengthMiddleware implements MiddlewareInterface
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
{
$body = $request->getParsedBody();
if (! isset($body[ShortUrlMetaInputFilter::SHORT_CODE_LENGTH])) {
$body[ShortUrlMetaInputFilter::SHORT_CODE_LENGTH] = $this->defaultShortCodesLength;
if (! isset($body[ShortUrlInputFilter::SHORT_CODE_LENGTH])) {
$body[ShortUrlInputFilter::SHORT_CODE_LENGTH] = $this->defaultShortCodesLength;
}
return $handler->handle($request->withParsedBody($body));