fix:修复BUG/升级1.1.6版本

This commit is contained in:
Ying
2023-04-25 20:11:49 +08:00
parent 445e5f9662
commit 6a6866bbaf
2357 changed files with 456920 additions and 140567 deletions

View File

@@ -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));

View File

@@ -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

View File

@@ -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

View File

@@ -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);

View File

@@ -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