1 | <?php |
||
2 | |||
3 | namespace Halfpastfour\PHPChartJS\Options\Elements; |
||
4 | |||
5 | use Halfpastfour\PHPChartJS\ArraySerializableInterface; |
||
6 | use Halfpastfour\PHPChartJS\Delegate\ArraySerializable; |
||
7 | use JsonSerializable; |
||
8 | |||
9 | /** |
||
10 | * Class Rectangle |
||
11 | * |
||
12 | * @package Halfpastfour\PHPChartJS\Options\Elements |
||
13 | */ |
||
14 | class Rectangle implements ArraySerializableInterface, JsonSerializable |
||
15 | { |
||
16 | use ArraySerializable; |
||
17 | |||
18 | const BORDER_SKIPPED_BOTTOM = 'bottom'; |
||
19 | const BORDER_SKIPPED_LEFT = 'left'; |
||
20 | const BORDER_SKIPPED_TOP = 'top'; |
||
21 | const BORDER_SKIPPED_RIGHT = 'right'; |
||
22 | |||
23 | /** |
||
24 | * Bar fill color. |
||
25 | * |
||
26 | * @default 'rgba(0,0,0,0.1)' |
||
27 | * @var string |
||
28 | */ |
||
29 | private $backgroundColor; |
||
30 | |||
31 | /** |
||
32 | * Bar stroke width. |
||
33 | * |
||
34 | * @default 0 |
||
35 | * @var int |
||
36 | */ |
||
37 | private $borderWidth; |
||
38 | |||
39 | /** |
||
40 | * Bar stroke color. |
||
41 | * |
||
42 | * @default 'rgba(0,0,0,0.1)' |
||
43 | * @var string |
||
44 | */ |
||
45 | private $borderColor; |
||
46 | |||
47 | /** |
||
48 | * Skipped (excluded) border: 'bottom', 'left', 'top' or 'right'. |
||
49 | * |
||
50 | * @default self::BORDER_SKIPPED_BOTTOM |
||
51 | * @var string |
||
52 | */ |
||
53 | private $borderSkipped; |
||
54 | |||
55 | /** |
||
56 | * @return string |
||
57 | */ |
||
58 | public function getBackgroundColor() |
||
59 | { |
||
60 | return $this->backgroundColor; |
||
61 | } |
||
62 | |||
63 | /** |
||
64 | * @param string $backgroundColor |
||
65 | * |
||
66 | * @return Rectangle |
||
67 | */ |
||
68 | public function setBackgroundColor($backgroundColor) |
||
69 | { |
||
70 | $this->backgroundColor = is_null($backgroundColor) ? null : strval($backgroundColor); |
||
0 ignored issues
–
show
introduced
by
![]() |
|||
71 | |||
72 | return $this; |
||
73 | } |
||
74 | |||
75 | /** |
||
76 | * @return int |
||
77 | */ |
||
78 | public function getBorderWidth() |
||
79 | { |
||
80 | return $this->borderWidth; |
||
81 | } |
||
82 | |||
83 | /** |
||
84 | * @param int $borderWidth |
||
85 | * |
||
86 | * @return Rectangle |
||
87 | */ |
||
88 | public function setBorderWidth($borderWidth) |
||
89 | { |
||
90 | $this->borderWidth = intval($borderWidth); |
||
91 | |||
92 | return $this; |
||
93 | } |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getBorderColor() |
||
99 | { |
||
100 | return $this->borderColor; |
||
101 | } |
||
102 | |||
103 | /** |
||
104 | * @param string $borderColor |
||
105 | * |
||
106 | * @return Rectangle |
||
107 | */ |
||
108 | public function setBorderColor($borderColor) |
||
109 | { |
||
110 | $this->borderColor = is_null($borderColor) ? null : strval($borderColor); |
||
0 ignored issues
–
show
|
|||
111 | |||
112 | return $this; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * @return string |
||
117 | */ |
||
118 | public function getBorderSkipped() |
||
119 | { |
||
120 | return $this->borderSkipped; |
||
121 | } |
||
122 | |||
123 | /** |
||
124 | * @param string $borderSkipped |
||
125 | * |
||
126 | * @return Rectangle |
||
127 | */ |
||
128 | public function setBorderSkipped($borderSkipped) |
||
129 | { |
||
130 | $this->borderSkipped = is_null($borderSkipped) ? null : strval($borderSkipped); |
||
0 ignored issues
–
show
|
|||
131 | |||
132 | return $this; |
||
133 | } |
||
134 | |||
135 | /** |
||
136 | * @return array |
||
137 | */ |
||
138 | public function jsonSerialize() |
||
139 | { |
||
140 | return $this->getArrayCopy(); |
||
141 | } |
||
142 | } |
||
143 |