1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace Halfpastfour\PHPChartJS\Options\Elements; |
4
|
|
|
|
5
|
|
|
use Halfpastfour\PHPChartJS\ArraySerializableInterface; |
6
|
|
|
use Halfpastfour\PHPChartJS\Delegate\ArraySerializable; |
7
|
|
|
use Zend\Json\Json; |
8
|
|
|
|
9
|
|
|
/** |
10
|
|
|
* Class Arc |
11
|
|
|
* @package Halfpastfour\PHPChartJS\Options\Elements |
12
|
|
|
*/ |
13
|
|
|
class Arc implements ArraySerializableInterface, \JsonSerializable |
14
|
|
|
{ |
15
|
|
|
use ArraySerializable; |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* Arc fill color. |
19
|
|
|
* @default 'rgba(0,0,0,0.1)' |
20
|
|
|
* @var string |
21
|
|
|
*/ |
22
|
|
|
private $backgroundColor; |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Arc stroke color. |
26
|
|
|
* @default '#fff' |
27
|
|
|
* @var string |
28
|
|
|
*/ |
29
|
|
|
private $borderColor; |
30
|
|
|
|
31
|
|
|
/** |
32
|
|
|
* Arc stroke width. |
33
|
|
|
* @default 2 |
34
|
|
|
* @var int |
35
|
|
|
*/ |
36
|
|
|
private $borderWidth; |
37
|
|
|
|
38
|
|
|
/** |
39
|
|
|
* @return string |
40
|
|
|
*/ |
41
|
|
|
public function getBackgroundColor() |
42
|
|
|
{ |
43
|
|
|
return $this->backgroundColor; |
44
|
|
|
} |
45
|
|
|
|
46
|
|
|
/** |
47
|
|
|
* @param string $backgroundColor |
48
|
|
|
* @return Arc |
49
|
|
|
*/ |
50
|
|
|
public function setBackgroundColor($backgroundColor) |
51
|
|
|
{ |
52
|
|
|
$this->backgroundColor = is_null($backgroundColor) ? null : strval($backgroundColor); |
|
|
|
|
53
|
|
|
return $this; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* @return string |
58
|
|
|
*/ |
59
|
|
|
public function getBorderColor() |
60
|
|
|
{ |
61
|
|
|
return $this->borderColor; |
62
|
|
|
} |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @param string $borderColor |
66
|
|
|
* @return Arc |
67
|
|
|
*/ |
68
|
|
|
public function setBorderColor($borderColor) |
69
|
|
|
{ |
70
|
|
|
$this->borderColor = is_null($borderColor) ? null : strval($borderColor); |
|
|
|
|
71
|
|
|
return $this; |
72
|
|
|
} |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @return int |
76
|
|
|
*/ |
77
|
|
|
public function getBorderWidth() |
78
|
|
|
{ |
79
|
|
|
return $this->borderWidth; |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @param int $borderWidth |
84
|
|
|
* @return Arc |
85
|
|
|
*/ |
86
|
|
|
public function setBorderWidth($borderWidth) |
87
|
|
|
{ |
88
|
|
|
$this->borderWidth = intval($borderWidth); |
89
|
|
|
return $this; |
90
|
|
|
} |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @return string |
94
|
|
|
* @throws \ReflectionException |
95
|
|
|
* @throws \Zend_Reflection_Exception |
96
|
|
|
*/ |
97
|
|
|
public function jsonSerialize() |
98
|
|
|
{ |
99
|
|
|
return Json::encode($this->getArrayCopy()); |
100
|
|
|
} |
101
|
|
|
} |