mirror of
https://github.com/shlinkio/shlink.git
synced 2024-12-22 15:13:59 -06:00
Simplified some match expressions
This commit is contained in:
parent
18b4caa55e
commit
8e1cd67a3d
@ -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);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user