mirror of
https://github.com/shlinkio/shlink.git
synced 2026-02-28 04:03:12 +08:00
Removed more functional-php usages
This commit is contained in:
@@ -4,8 +4,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace Shlinkio\Shlink\Rest;
|
||||
|
||||
use function array_filter;
|
||||
use function array_map;
|
||||
use function Functional\first;
|
||||
use function reset;
|
||||
use function Shlinkio\Shlink\Config\loadConfigFromGlob;
|
||||
use function sprintf;
|
||||
|
||||
@@ -34,8 +35,9 @@ class ConfigProvider
|
||||
|
||||
private static function buildUnversionedHealthRouteFromExistingRoutes(array $routes): ?array
|
||||
{
|
||||
$healthRoute = first($routes, fn (array $route) => $route['path'] === '/health');
|
||||
if ($healthRoute === null) {
|
||||
$healthRoutes = array_filter($routes, fn (array $route) => $route['path'] === '/health');
|
||||
$healthRoute = reset($healthRoutes);
|
||||
if ($healthRoute === false) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ use Shlinkio\Shlink\Core\Exception\TagConflictException;
|
||||
use Shlinkio\Shlink\Core\Exception\TagNotFoundException;
|
||||
use Shlinkio\Shlink\Core\Exception\ValidationException;
|
||||
|
||||
use function end;
|
||||
use function explode;
|
||||
use function Functional\last;
|
||||
|
||||
/** @deprecated */
|
||||
class BackwardsCompatibleProblemDetailsException extends RuntimeException implements ProblemDetailsExceptionInterface
|
||||
@@ -77,7 +77,9 @@ class BackwardsCompatibleProblemDetailsException extends RuntimeException implem
|
||||
|
||||
private function remapType(string $wrappedType): string
|
||||
{
|
||||
$lastSegment = last(explode('/', $wrappedType));
|
||||
$segments = explode('/', $wrappedType);
|
||||
$lastSegment = end($segments);
|
||||
|
||||
return match ($lastSegment) {
|
||||
ValidationException::ERROR_CODE => 'INVALID_ARGUMENT',
|
||||
DeleteShortUrlException::ERROR_CODE => 'INVALID_SHORT_URL_DELETION',
|
||||
|
||||
Reference in New Issue
Block a user