mirror of
https://github.com/shlinkio/shlink.git
synced 2024-11-23 21:27:44 +03:00
Used lowercase values when trying to match the QR code error level
This commit is contained in:
parent
01e06f0503
commit
67c7e503d9
1 changed files with 5 additions and 6 deletions
|
@ -16,7 +16,6 @@ use Psr\Http\Message\ServerRequestInterface;
|
|||
use Psr\Http\Message\ServerRequestInterface as Request;
|
||||
|
||||
use function strtolower;
|
||||
use function strtoupper;
|
||||
use function trim;
|
||||
|
||||
final class QrCodeParams
|
||||
|
@ -82,12 +81,12 @@ final class QrCodeParams
|
|||
|
||||
private static function resolveErrorCorrection(array $query): ErrorCorrectionLevelInterface
|
||||
{
|
||||
$errorCorrectionLevel = strtoupper(trim($query['errorCorrection'] ?? ''));
|
||||
$errorCorrectionLevel = strtolower(trim($query['errorCorrection'] ?? 'l'));
|
||||
return match ($errorCorrectionLevel) {
|
||||
'H' => new ErrorCorrectionLevelHigh(),
|
||||
'Q' => new ErrorCorrectionLevelQuartile(),
|
||||
'M' => new ErrorCorrectionLevelMedium(),
|
||||
default => new ErrorCorrectionLevelLow(), // 'L'
|
||||
'h' => new ErrorCorrectionLevelHigh(),
|
||||
'q' => new ErrorCorrectionLevelQuartile(),
|
||||
'm' => new ErrorCorrectionLevelMedium(),
|
||||
default => new ErrorCorrectionLevelLow(), // 'l'
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue