|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
declare(strict_types=1); |
|
4
|
|
|
|
|
5
|
|
|
namespace MaxBeckers\AmazonAlexa\Response\Directives\APL\AVGItem; |
|
6
|
|
|
|
|
7
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\AVGItemType; |
|
8
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\FontStyle; |
|
9
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\FontWeight; |
|
10
|
|
|
use MaxBeckers\AmazonAlexa\Response\Directives\APL\Document\TextAnchor; |
|
11
|
|
|
|
|
12
|
|
|
class Text extends AVGItem implements \JsonSerializable |
|
13
|
|
|
{ |
|
14
|
|
|
public const TYPE = AVGItemType::TEXT; |
|
15
|
|
|
|
|
16
|
|
|
/** |
|
17
|
|
|
* @param string|null $fill Fill color |
|
18
|
|
|
* @param int|null $fillOpacity Fill opacity |
|
19
|
|
|
* @param string|null $fillTransform Fill transform |
|
20
|
|
|
* @param string|null $fontFamily Font family |
|
21
|
|
|
* @param int|null $fontSize Font size |
|
22
|
|
|
* @param FontStyle|null $fontStyle Font style |
|
23
|
|
|
* @param FontWeight|null $fontWeight Font weight |
|
24
|
|
|
* @param int|null $letterSpacing Letter spacing |
|
25
|
|
|
* @param string|null $stroke Stroke color |
|
26
|
|
|
* @param int|null $strokeOpacity Stroke opacity |
|
27
|
|
|
* @param string|null $strokeTransform Stroke transform |
|
28
|
|
|
* @param int|null $strokeWidth Stroke width |
|
29
|
|
|
* @param string|null $text Text content |
|
30
|
|
|
* @param TextAnchor|null $textAnchor Text anchor position |
|
31
|
|
|
* @param int|null $x X coordinate |
|
32
|
|
|
* @param int|null $y Y coordinate |
|
33
|
|
|
*/ |
|
34
|
12 |
|
public function __construct( |
|
35
|
|
|
public ?string $fill = null, |
|
36
|
|
|
public ?int $fillOpacity = null, |
|
37
|
|
|
public ?string $fillTransform = null, |
|
38
|
|
|
public ?string $fontFamily = null, |
|
39
|
|
|
public ?int $fontSize = null, |
|
40
|
|
|
public ?FontStyle $fontStyle = null, |
|
41
|
|
|
public ?FontWeight $fontWeight = null, |
|
42
|
|
|
public ?int $letterSpacing = null, |
|
43
|
|
|
public ?string $stroke = null, |
|
44
|
|
|
public ?int $strokeOpacity = null, |
|
45
|
|
|
public ?string $strokeTransform = null, |
|
46
|
|
|
public ?int $strokeWidth = null, |
|
47
|
|
|
public ?string $text = null, |
|
48
|
|
|
public ?TextAnchor $textAnchor = null, |
|
49
|
|
|
public ?int $x = null, |
|
50
|
|
|
public ?int $y = null, |
|
51
|
|
|
) { |
|
52
|
12 |
|
parent::__construct(self::TYPE); |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
8 |
|
public function jsonSerialize(): array |
|
56
|
|
|
{ |
|
57
|
8 |
|
$data = parent::jsonSerialize(); |
|
58
|
|
|
|
|
59
|
8 |
|
if ($this->fill !== null) { |
|
60
|
1 |
|
$data['fill'] = $this->fill; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
8 |
|
if ($this->fillOpacity !== null) { |
|
64
|
2 |
|
$data['fillOpacity'] = $this->fillOpacity; |
|
65
|
|
|
} |
|
66
|
|
|
|
|
67
|
8 |
|
if ($this->fillTransform !== null) { |
|
68
|
1 |
|
$data['fillTransform'] = $this->fillTransform; |
|
69
|
|
|
} |
|
70
|
|
|
|
|
71
|
8 |
|
if ($this->fontFamily !== null) { |
|
72
|
2 |
|
$data['fontFamily'] = $this->fontFamily; |
|
73
|
|
|
} |
|
74
|
|
|
|
|
75
|
8 |
|
if ($this->fontSize !== null) { |
|
76
|
2 |
|
$data['fontSize'] = $this->fontSize; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
8 |
|
if ($this->fontStyle !== null) { |
|
80
|
2 |
|
$data['fontStyle'] = $this->fontStyle->value; |
|
81
|
|
|
} |
|
82
|
|
|
|
|
83
|
8 |
|
if ($this->fontWeight !== null) { |
|
84
|
2 |
|
$data['fontWeight'] = $this->fontWeight->value; |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
8 |
|
if ($this->letterSpacing !== null) { |
|
88
|
2 |
|
$data['letterSpacing'] = $this->letterSpacing; |
|
89
|
|
|
} |
|
90
|
|
|
|
|
91
|
8 |
|
if ($this->stroke !== null) { |
|
92
|
1 |
|
$data['stroke'] = $this->stroke; |
|
93
|
|
|
} |
|
94
|
|
|
|
|
95
|
8 |
|
if ($this->strokeOpacity !== null) { |
|
96
|
2 |
|
$data['strokeOpacity'] = $this->strokeOpacity; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
8 |
|
if ($this->strokeTransform !== null) { |
|
100
|
1 |
|
$data['strokeTransform'] = $this->strokeTransform; |
|
101
|
|
|
} |
|
102
|
|
|
|
|
103
|
8 |
|
if ($this->strokeWidth !== null) { |
|
104
|
2 |
|
$data['strokeWidth'] = $this->strokeWidth; |
|
105
|
|
|
} |
|
106
|
|
|
|
|
107
|
8 |
|
if ($this->text !== null) { |
|
108
|
2 |
|
$data['text'] = $this->text; |
|
109
|
|
|
} |
|
110
|
|
|
|
|
111
|
8 |
|
if ($this->textAnchor !== null) { |
|
112
|
3 |
|
$data['textAnchor'] = $this->textAnchor->value; |
|
113
|
|
|
} |
|
114
|
|
|
|
|
115
|
8 |
|
if ($this->x !== null) { |
|
116
|
3 |
|
$data['x'] = $this->x; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
8 |
|
if ($this->y !== null) { |
|
120
|
3 |
|
$data['y'] = $this->y; |
|
121
|
|
|
} |
|
122
|
|
|
|
|
123
|
8 |
|
return $data; |
|
124
|
|
|
} |
|
125
|
|
|
} |
|
126
|
|
|
|