Deleted deprecated constant

This commit is contained in:
Alejandro Celaya
2019-01-29 13:20:46 +01:00
parent ea1b285d52
commit 5756609531
4 changed files with 9 additions and 11 deletions

View File

@@ -38,15 +38,11 @@ abstract class AbstractCreateShortUrlAction extends AbstractRestAction
/**
* @param Request $request
* @return Response
* @throws \InvalidArgumentException
*/
public function handle(Request $request): Response
{
try {
$shortUrlData = $this->buildShortUrlData($request);
$shortUrlMeta = $shortUrlData->getMeta();
$longUrl = $shortUrlData->getLongUrl();
$customSlug = $shortUrlMeta->getCustomSlug();
} catch (InvalidArgumentException $e) {
$this->logger->warning('Provided data is invalid. {e}', ['e' => $e]);
return new JsonResponse([
@@ -55,6 +51,10 @@ abstract class AbstractCreateShortUrlAction extends AbstractRestAction
], self::STATUS_BAD_REQUEST);
}
$longUrl = $shortUrlData->getLongUrl();
$shortUrlMeta = $shortUrlData->getMeta();
$customSlug = $shortUrlMeta->getCustomSlug();
try {
$shortUrl = $this->urlShortener->urlToShortCode(
$longUrl,