mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-08 08:13:11 +08:00
Updated to readonly public props on as many models as possible
This commit is contained in:
@@ -29,11 +29,11 @@ final class QrCodeParams
|
||||
private const SUPPORTED_FORMATS = ['png', 'svg'];
|
||||
|
||||
private function __construct(
|
||||
private int $size,
|
||||
private int $margin,
|
||||
private WriterInterface $writer,
|
||||
private ErrorCorrectionLevelInterface $errorCorrectionLevel,
|
||||
private RoundBlockSizeModeInterface $roundBlockSizeMode,
|
||||
public readonly int $size,
|
||||
public readonly int $margin,
|
||||
public readonly WriterInterface $writer,
|
||||
public readonly ErrorCorrectionLevelInterface $errorCorrectionLevel,
|
||||
public readonly RoundBlockSizeModeInterface $roundBlockSizeMode,
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -105,29 +105,4 @@ final class QrCodeParams
|
||||
{
|
||||
return strtolower(trim($param));
|
||||
}
|
||||
|
||||
public function size(): int
|
||||
{
|
||||
return $this->size;
|
||||
}
|
||||
|
||||
public function margin(): int
|
||||
{
|
||||
return $this->margin;
|
||||
}
|
||||
|
||||
public function writer(): WriterInterface
|
||||
{
|
||||
return $this->writer;
|
||||
}
|
||||
|
||||
public function errorCorrectionLevel(): ErrorCorrectionLevelInterface
|
||||
{
|
||||
return $this->errorCorrectionLevel;
|
||||
}
|
||||
|
||||
public function roundBlockSizeMode(): RoundBlockSizeModeInterface
|
||||
{
|
||||
return $this->roundBlockSizeMode;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,11 +42,11 @@ class QrCodeAction implements MiddlewareInterface
|
||||
$params = QrCodeParams::fromRequest($request, $this->defaultOptions);
|
||||
$qrCodeBuilder = Builder::create()
|
||||
->data($this->stringifier->stringify($shortUrl))
|
||||
->size($params->size())
|
||||
->margin($params->margin())
|
||||
->writer($params->writer())
|
||||
->errorCorrectionLevel($params->errorCorrectionLevel())
|
||||
->roundBlockSizeMode($params->roundBlockSizeMode());
|
||||
->size($params->size)
|
||||
->margin($params->margin)
|
||||
->writer($params->writer)
|
||||
->errorCorrectionLevel($params->errorCorrectionLevel)
|
||||
->roundBlockSizeMode($params->roundBlockSizeMode);
|
||||
|
||||
return new QrCodeResponse($qrCodeBuilder->build());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user