fix:修复BUG/升级1.1.6版本
This commit is contained in:
16
vendor/endroid/qr-code/src/Label/Font/Font.php
vendored
16
vendor/endroid/qr-code/src/Label/Font/Font.php
vendored
@@ -6,18 +6,14 @@ namespace Endroid\QrCode\Label\Font;
|
||||
|
||||
final class Font implements FontInterface
|
||||
{
|
||||
private string $path;
|
||||
private int $size;
|
||||
|
||||
public function __construct(string $path, int $size = 16)
|
||||
{
|
||||
$this->validatePath($path);
|
||||
|
||||
$this->path = $path;
|
||||
$this->size = $size;
|
||||
public function __construct(
|
||||
private string $path,
|
||||
private int $size = 16
|
||||
) {
|
||||
$this->assertValidPath($path);
|
||||
}
|
||||
|
||||
private function validatePath(string $path): void
|
||||
private function assertValidPath(string $path): void
|
||||
{
|
||||
if (!file_exists($path)) {
|
||||
throw new \Exception(sprintf('Invalid font path "%s"', $path));
|
||||
|
||||
@@ -6,11 +6,9 @@ namespace Endroid\QrCode\Label\Font;
|
||||
|
||||
final class NotoSans implements FontInterface
|
||||
{
|
||||
private int $size;
|
||||
|
||||
public function __construct(int $size = 16)
|
||||
{
|
||||
$this->size = $size;
|
||||
public function __construct(
|
||||
private int $size = 16
|
||||
) {
|
||||
}
|
||||
|
||||
public function getPath(): string
|
||||
|
||||
@@ -6,11 +6,9 @@ namespace Endroid\QrCode\Label\Font;
|
||||
|
||||
final class OpenSans implements FontInterface
|
||||
{
|
||||
private int $size;
|
||||
|
||||
public function __construct(int $size = 16)
|
||||
{
|
||||
$this->size = $size;
|
||||
public function __construct(
|
||||
private int $size = 16
|
||||
) {
|
||||
}
|
||||
|
||||
public function getPath(): string
|
||||
|
||||
12
vendor/endroid/qr-code/src/Label/Label.php
vendored
12
vendor/endroid/qr-code/src/Label/Label.php
vendored
@@ -15,20 +15,18 @@ use Endroid\QrCode\Label\Margin\MarginInterface;
|
||||
|
||||
final class Label implements LabelInterface
|
||||
{
|
||||
private string $text;
|
||||
private FontInterface $font;
|
||||
private LabelAlignmentInterface $alignment;
|
||||
private MarginInterface $margin;
|
||||
private ColorInterface $textColor;
|
||||
|
||||
public function __construct(
|
||||
string $text,
|
||||
FontInterface $font = null,
|
||||
LabelAlignmentInterface $alignment = null,
|
||||
MarginInterface $margin = null,
|
||||
ColorInterface $textColor = null
|
||||
private string $text,
|
||||
FontInterface|null $font = null,
|
||||
LabelAlignmentInterface|null $alignment = null,
|
||||
MarginInterface|null $margin = null,
|
||||
ColorInterface|null $textColor = null
|
||||
) {
|
||||
$this->text = $text;
|
||||
$this->font = $font ?? new Font(__DIR__.'/../../assets/noto_sans.otf', 16);
|
||||
$this->alignment = $alignment ?? new LabelAlignmentCenter();
|
||||
$this->margin = $margin ?? new Margin(0, 10, 10, 10);
|
||||
|
||||
@@ -6,17 +6,12 @@ namespace Endroid\QrCode\Label\Margin;
|
||||
|
||||
final class Margin implements MarginInterface
|
||||
{
|
||||
private int $top;
|
||||
private int $right;
|
||||
private int $bottom;
|
||||
private int $left;
|
||||
|
||||
public function __construct(int $top, int $right, int $bottom, int $left)
|
||||
{
|
||||
$this->top = $top;
|
||||
$this->right = $right;
|
||||
$this->bottom = $bottom;
|
||||
$this->left = $left;
|
||||
public function __construct(
|
||||
private int $top,
|
||||
private int $right,
|
||||
private int $bottom,
|
||||
private int $left
|
||||
) {
|
||||
}
|
||||
|
||||
public function getTop(): int
|
||||
|
||||
Reference in New Issue
Block a user