Debian Codegraph @

vendor/endroid/qr-code/src/Label/Label.php

raw
1 <?php
2
3 declare(strict_types=1);
4
5 namespace Endroid\QrCode\Label;
6
7 use Endroid\QrCode\Color\Color;
8 use Endroid\QrCode\Color\ColorInterface;
9 use Endroid\QrCode\Label\Font\Font;
10 use Endroid\QrCode\Label\Font\FontInterface;
11 use Endroid\QrCode\Label\Margin\Margin;
12 use Endroid\QrCode\Label\Margin\MarginInterface;
13
14 final class Label implements LabelInterface
15 {
16 public function __construct(
17 private string $text,
18 private FontInterface $font = new Font(__DIR__.'/../../assets/noto_sans.otf', 16),
19 private LabelAlignment $alignment = LabelAlignment::Center,
20 private MarginInterface $margin = new Margin(0, 10, 10, 10),
21 private ColorInterface $textColor = new Color(0, 0, 0)
22 ) {
23 }
24
25 public static function create(string $text): self
26 {
27 return new self($text);
28 }
29
30 public function getText(): string
31 {
32 return $this->text;
33 }
34
35 public function setText(string $text): self
36 {
37 $this->text = $text;
38
39 return $this;
40 }
41
42 public function getFont(): FontInterface
43 {
44 return $this->font;
45 }
46
47 public function setFont(FontInterface $font): self
48 {
49 $this->font = $font;
50
51 return $this;
52 }
53
54 public function getAlignment(): LabelAlignment
55 {
56 return $this->alignment;
57 }
58
59 public function setAlignment(LabelAlignment $alignment): self
60 {
61 $this->alignment = $alignment;
62
63 return $this;
64 }
65
66 public function getMargin(): MarginInterface
67 {
68 return $this->margin;
69 }
70
71 public function setMargin(MarginInterface $margin): self
72 {
73 $this->margin = $margin;
74
75 return $this;
76 }
77
78 public function getTextColor(): ColorInterface
79 {
80 return $this->textColor;
81 }
82
83 public function setTextColor(ColorInterface $textColor): self
84 {
85 $this->textColor = $textColor;
86
87 return $this;
88 }
89 }