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

@@ -6,7 +6,7 @@ namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
use Psr\Http\Message\ServerRequestInterface as Request;
use Shlinkio\Shlink\Core\Model\ShortUrlMeta;
use Shlinkio\Shlink\Core\Validation\ShortUrlMetaInputFilter;
use Shlinkio\Shlink\Core\Validation\ShortUrlInputFilter;
use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction
@@ -21,10 +21,10 @@ class SingleStepCreateShortUrlAction extends AbstractCreateShortUrlAction
$apiKey = AuthenticationMiddleware::apiKeyFromRequest($request);
return ShortUrlMeta::fromRawData([
ShortUrlMetaInputFilter::LONG_URL => $longUrl,
ShortUrlMetaInputFilter::API_KEY => $apiKey,
ShortUrlInputFilter::LONG_URL => $longUrl,
ShortUrlInputFilter::API_KEY => $apiKey,
// This will usually be null, unless this API key enforces one specific domain
ShortUrlMetaInputFilter::DOMAIN => $request->getAttribute(ShortUrlMetaInputFilter::DOMAIN),
ShortUrlInputFilter::DOMAIN => $request->getAttribute(ShortUrlInputFilter::DOMAIN),
]);
}
}