1 | <?php |
||
2 | |||
3 | namespace Halfpastfour\PHPChartJS\Options; |
||
4 | |||
5 | use Halfpastfour\PHPChartJS\ArraySerializableInterface; |
||
6 | use Halfpastfour\PHPChartJS\Delegate\ArraySerializable; |
||
7 | use Halfpastfour\PHPChartJS\Options\Layout\Padding; |
||
8 | use JsonSerializable; |
||
9 | |||
10 | /** |
||
11 | * Class Layout |
||
12 | * |
||
13 | * @package Halfpastfour\PHPChartJS\Options |
||
14 | */ |
||
15 | class Layout implements ArraySerializableInterface, JsonSerializable |
||
16 | { |
||
17 | use ArraySerializable; |
||
18 | |||
19 | /** |
||
20 | * @var int|Padding |
||
21 | */ |
||
22 | private $padding; |
||
23 | |||
24 | /** |
||
25 | * @param int $padding |
||
26 | */ |
||
27 | public function setPadding($padding) |
||
28 | { |
||
29 | $this->padding = intval($padding); |
||
30 | } |
||
31 | |||
32 | /** |
||
33 | * @return int|Padding |
||
34 | */ |
||
35 | public function getPadding() |
||
36 | { |
||
37 | return $this->padding; |
||
38 | } |
||
39 | |||
40 | /** |
||
41 | * @return Padding |
||
42 | */ |
||
43 | public function padding() |
||
44 | { |
||
45 | if (is_null($this->padding)) { |
||
46 | $this->padding = new Padding(); |
||
47 | } |
||
48 | |||
49 | return $this->padding; |
||
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
50 | } |
||
51 | |||
52 | /** |
||
53 | * @return array |
||
54 | */ |
||
55 | public function jsonSerialize() |
||
56 | { |
||
57 | return $this->getArrayCopy(); |
||
58 | } |
||
59 | } |
||
60 |