mirror of
https://github.com/shlinkio/shlink.git
synced 2025-02-16 18:24:56 -06:00
Deleted deprecated constant
This commit is contained in:
parent
ea1b285d52
commit
5756609531
@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shlinkio\Shlink\CLI\Command\Config;
|
namespace Shlinkio\Shlink\CLI\Command\Config;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
|
||||||
use Symfony\Component\Console\Command\Command;
|
use Symfony\Component\Console\Command\Command;
|
||||||
use Symfony\Component\Console\Input\InputInterface;
|
use Symfony\Component\Console\Input\InputInterface;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
@ -22,13 +22,13 @@ class GenerateCharsetCommand extends Command
|
|||||||
->setDescription(sprintf(
|
->setDescription(sprintf(
|
||||||
'Generates a character set sample just by shuffling the default one, "%s". '
|
'Generates a character set sample just by shuffling the default one, "%s". '
|
||||||
. 'Then it can be set in the SHORTCODE_CHARS environment variable',
|
. 'Then it can be set in the SHORTCODE_CHARS environment variable',
|
||||||
UrlShortener::DEFAULT_CHARS
|
UrlShortenerOptions::DEFAULT_CHARS
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function execute(InputInterface $input, OutputInterface $output): void
|
protected function execute(InputInterface $input, OutputInterface $output): void
|
||||||
{
|
{
|
||||||
$charSet = str_shuffle(UrlShortener::DEFAULT_CHARS);
|
$charSet = str_shuffle(UrlShortenerOptions::DEFAULT_CHARS);
|
||||||
(new SymfonyStyle($input, $output))->success(sprintf('Character set: "%s"', $charSet));
|
(new SymfonyStyle($input, $output))->success(sprintf('Character set: "%s"', $charSet));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,8 +29,6 @@ class UrlShortener implements UrlShortenerInterface
|
|||||||
{
|
{
|
||||||
use TagManagerTrait;
|
use TagManagerTrait;
|
||||||
|
|
||||||
/** @deprecated */
|
|
||||||
public const DEFAULT_CHARS = UrlShortenerOptions::DEFAULT_CHARS;
|
|
||||||
private const ID_INCREMENT = 200000;
|
private const ID_INCREMENT = 200000;
|
||||||
|
|
||||||
/** @var ClientInterface */
|
/** @var ClientInterface */
|
||||||
|
@ -3,7 +3,7 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Shlinkio\Shlink\Installer\Config\Plugin;
|
namespace Shlinkio\Shlink\Installer\Config\Plugin;
|
||||||
|
|
||||||
use Shlinkio\Shlink\Core\Service\UrlShortener;
|
use Shlinkio\Shlink\Core\Options\UrlShortenerOptions;
|
||||||
use Shlinkio\Shlink\Installer\Model\CustomizableAppConfig;
|
use Shlinkio\Shlink\Installer\Model\CustomizableAppConfig;
|
||||||
use Shlinkio\Shlink\Installer\Util\AskUtilsTrait;
|
use Shlinkio\Shlink\Installer\Util\AskUtilsTrait;
|
||||||
use Symfony\Component\Console\Style\SymfonyStyle;
|
use Symfony\Component\Console\Style\SymfonyStyle;
|
||||||
@ -66,7 +66,7 @@ class UrlShortenerConfigCustomizer implements ConfigCustomizerInterface
|
|||||||
case self::CHARS:
|
case self::CHARS:
|
||||||
return $io->ask(
|
return $io->ask(
|
||||||
'Character set for generated short codes (leave empty to autogenerate one)'
|
'Character set for generated short codes (leave empty to autogenerate one)'
|
||||||
) ?: str_shuffle(UrlShortener::DEFAULT_CHARS);
|
) ?: str_shuffle(UrlShortenerOptions::DEFAULT_CHARS);
|
||||||
case self::VALIDATE_URL:
|
case self::VALIDATE_URL:
|
||||||
return $io->confirm('Do you want to validate long urls by 200 HTTP status code on response');
|
return $io->confirm('Do you want to validate long urls by 200 HTTP status code on response');
|
||||||
case self::ENABLE_NOT_FOUND_REDIRECTION:
|
case self::ENABLE_NOT_FOUND_REDIRECTION:
|
||||||
|
@ -38,15 +38,11 @@ abstract class AbstractCreateShortUrlAction extends AbstractRestAction
|
|||||||
/**
|
/**
|
||||||
* @param Request $request
|
* @param Request $request
|
||||||
* @return Response
|
* @return Response
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
*/
|
*/
|
||||||
public function handle(Request $request): Response
|
public function handle(Request $request): Response
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
$shortUrlData = $this->buildShortUrlData($request);
|
$shortUrlData = $this->buildShortUrlData($request);
|
||||||
$shortUrlMeta = $shortUrlData->getMeta();
|
|
||||||
$longUrl = $shortUrlData->getLongUrl();
|
|
||||||
$customSlug = $shortUrlMeta->getCustomSlug();
|
|
||||||
} catch (InvalidArgumentException $e) {
|
} catch (InvalidArgumentException $e) {
|
||||||
$this->logger->warning('Provided data is invalid. {e}', ['e' => $e]);
|
$this->logger->warning('Provided data is invalid. {e}', ['e' => $e]);
|
||||||
return new JsonResponse([
|
return new JsonResponse([
|
||||||
@ -55,6 +51,10 @@ abstract class AbstractCreateShortUrlAction extends AbstractRestAction
|
|||||||
], self::STATUS_BAD_REQUEST);
|
], self::STATUS_BAD_REQUEST);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$longUrl = $shortUrlData->getLongUrl();
|
||||||
|
$shortUrlMeta = $shortUrlData->getMeta();
|
||||||
|
$customSlug = $shortUrlMeta->getCustomSlug();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$shortUrl = $this->urlShortener->urlToShortCode(
|
$shortUrl = $this->urlShortener->urlToShortCode(
|
||||||
$longUrl,
|
$longUrl,
|
||||||
|
Loading…
Reference in New Issue
Block a user