mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-09 08:43:13 +08:00
Replaced all FQ global function and constants by explicit imports
This commit is contained in:
@@ -3,6 +3,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Rest\Action\ShortUrl;
|
||||
|
||||
use Exception;
|
||||
use Psr\Http\Message\ResponseInterface as Response;
|
||||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@@ -14,6 +15,7 @@ use Shlinkio\Shlink\Rest\Action\AbstractRestAction;
|
||||
use Shlinkio\Shlink\Rest\Util\RestUtils;
|
||||
use Zend\Diactoros\Response\JsonResponse;
|
||||
use Zend\I18n\Translator\TranslatorInterface;
|
||||
use function sprintf;
|
||||
|
||||
class ResolveShortUrlAction extends AbstractRestAction
|
||||
{
|
||||
@@ -62,7 +64,7 @@ class ResolveShortUrlAction extends AbstractRestAction
|
||||
$this->logger->warning('Provided short code with invalid format. {e}', ['e' => $e]);
|
||||
return new JsonResponse([
|
||||
'error' => RestUtils::getRestErrorCodeFromException($e),
|
||||
'message' => \sprintf(
|
||||
'message' => sprintf(
|
||||
$this->translator->translate('Provided short code "%s" has an invalid format'),
|
||||
$shortCode
|
||||
),
|
||||
@@ -71,9 +73,9 @@ class ResolveShortUrlAction extends AbstractRestAction
|
||||
$this->logger->warning('Provided short code couldn\'t be found. {e}', ['e' => $e]);
|
||||
return new JsonResponse([
|
||||
'error' => RestUtils::INVALID_ARGUMENT_ERROR,
|
||||
'message' => \sprintf($this->translator->translate('No URL found for short code "%s"'), $shortCode),
|
||||
'message' => sprintf($this->translator->translate('No URL found for short code "%s"'), $shortCode),
|
||||
], self::STATUS_NOT_FOUND);
|
||||
} catch (\Exception $e) {
|
||||
} catch (Exception $e) {
|
||||
$this->logger->error('Unexpected error while resolving the URL behind a short code. {e}', ['e' => $e]);
|
||||
return new JsonResponse([
|
||||
'error' => RestUtils::UNKNOWN_ERROR,
|
||||
|
||||
Reference in New Issue
Block a user