Remove last references to functional-php

This commit is contained in:
Alejandro Celaya
2023-11-30 18:09:15 +01:00
parent bff4bd12ae
commit 1854cc2f19
22 changed files with 147 additions and 114 deletions

View File

@@ -17,7 +17,8 @@ use Symfony\Component\Process\PhpExecutableFinder;
use Throwable;
use function array_map;
use function Shlinkio\Shlink\Core\contains;
use function Shlinkio\Shlink\Core\ArrayUtils\contains;
use function Shlinkio\Shlink\Core\ArrayUtils\some;
class CreateDatabaseCommand extends AbstractDatabaseCommand
{
@@ -71,15 +72,9 @@ class CreateDatabaseCommand extends AbstractDatabaseCommand
$allMetadata = $this->em->getMetadataFactory()->getAllMetadata();
$shlinkTables = array_map(static fn (ClassMetadata $metadata) => $metadata->getTableName(), $allMetadata);
foreach ($shlinkTables as $shlinkTable) {
// If at least one of the shlink tables exist, we will consider the database exists somehow.
// Any other inconsistency will be taken care of by the migrations.
if (contains($shlinkTable, $existingTables)) {
return true;
}
}
return false;
// If at least one of the shlink tables exist, we will consider the database exists somehow.
// Any other inconsistency will be taken care of by the migrations.
return some($shlinkTables, static fn (string $shlinkTable) => contains($shlinkTable, $existingTables));
}
private function ensureDatabaseExistsAndGetTables(): array

View File

@@ -22,7 +22,7 @@ use Symfony\Component\Console\Style\SymfonyStyle;
use function array_map;
use function array_unique;
use function explode;
use function Shlinkio\SHlink\Core\flatten;
use function Shlinkio\Shlink\Core\ArrayUtils\flatten;
use function sprintf;
class CreateShortUrlCommand extends Command

View File

@@ -16,14 +16,11 @@ use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use function array_filter;
use function array_keys;
use function array_map;
use function Shlinkio\Shlink\Common\buildDateRange;
use function Shlinkio\Shlink\Core\ArrayUtils\select_keys;
use function Shlinkio\Shlink\Core\camelCaseToHumanFriendly;
use function Shlinkio\Shlink\Core\contains;
use const ARRAY_FILTER_USE_KEY;
abstract class AbstractVisitsListCommand extends Command
{
@@ -64,14 +61,7 @@ abstract class AbstractVisitsListCommand extends Command
];
// Filter out unknown keys
return array_filter(
$rowData,
static fn (string $key) => contains(
$key,
['referer', 'date', 'userAgent', 'country', 'city', ...$extraKeys],
),
ARRAY_FILTER_USE_KEY,
);
return select_keys($rowData, ['referer', 'date', 'userAgent', 'country', 'city', ...$extraKeys]);
}, [...$paginator->getCurrentPageResults()]);
$extra = array_map(camelCaseToHumanFriendly(...), $extraKeys);