mirror of
https://github.com/shlinkio/shlink.git
synced 2025-03-14 04:00:57 +03:00
Merge pull request #1292 from acelaya-forks/feature/simplify-matches
Simplified some match expressions
This commit is contained in:
commit
4103ccf791
5 changed files with 9 additions and 10 deletions
|
@ -52,7 +52,7 @@
|
|||
"shlinkio/shlink-config": "^1.4",
|
||||
"shlinkio/shlink-event-dispatcher": "^2.3",
|
||||
"shlinkio/shlink-importer": "^2.5",
|
||||
"shlinkio/shlink-installer": "dev-develop#64f8ab2 as 7.0",
|
||||
"shlinkio/shlink-installer": "dev-develop#a008036 as 7.0",
|
||||
"shlinkio/shlink-ip-geolocation": "^2.2",
|
||||
"symfony/console": "^6.0",
|
||||
"symfony/filesystem": "^6.0",
|
||||
|
|
|
@ -21,8 +21,8 @@ return (static function (): array {
|
|||
'mssql' => '1433',
|
||||
default => '3306',
|
||||
};
|
||||
$resolveConnection = static fn () => match (true) {
|
||||
$driver === null || $driver === 'sqlite' => [
|
||||
$resolveConnection = static fn () => match ($driver) {
|
||||
null, 'sqlite' => [
|
||||
'driver' => 'pdo_sqlite',
|
||||
'path' => 'data/database.sqlite',
|
||||
],
|
||||
|
|
|
@ -7,8 +7,8 @@ use function Shlinkio\Shlink\Common\env;
|
|||
return (static function (): array {
|
||||
$redisServers = env('REDIS_SERVERS');
|
||||
|
||||
return match (true) {
|
||||
$redisServers === null => [],
|
||||
return match ($redisServers) {
|
||||
null => [],
|
||||
default => [
|
||||
'cache' => [
|
||||
'redis' => [
|
||||
|
|
|
@ -83,10 +83,9 @@ class RequestTracker implements RequestTrackerInterface, RequestMethodInterface
|
|||
$disableTrackingFrom = $this->trackingOptions->disableTrackingFrom();
|
||||
|
||||
return some($disableTrackingFrom, function (string $value) use ($ip, $remoteAddrParts): bool {
|
||||
$range = match (true) {
|
||||
str_contains($value, '*') => $this->parseValueWithWildcards($value, $remoteAddrParts),
|
||||
default => Factory::parseRangeString($value),
|
||||
};
|
||||
$range = str_contains($value, '*')
|
||||
? $this->parseValueWithWildcards($value, $remoteAddrParts)
|
||||
: Factory::parseRangeString($value);
|
||||
|
||||
return $range !== null && $ip->matches($range);
|
||||
});
|
||||
|
|
|
@ -41,7 +41,7 @@ class ApiKeyService implements ApiKeyServiceInterface
|
|||
$expirationDate !== null && $name !== null => ApiKey::fromMeta(
|
||||
ApiKeyMeta::withNameAndExpirationDate($name, $expirationDate),
|
||||
),
|
||||
$expirationDate !== null => ApiKey::fromMeta(ApiKeyMeta::withExpirationDate($expirationDate)),
|
||||
$expirationDate !== null => ApiKey::fromMeta(ApiKeyMeta::withExpirationDate($expirationDate)),
|
||||
$name !== null => ApiKey::fromMeta(ApiKeyMeta::withName($name)),
|
||||
default => ApiKey::create(),
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue