1 | <?php |
||
27 | class Dimensions implements JsonSerializable |
||
28 | { |
||
29 | /** |
||
30 | * The width |
||
31 | * |
||
32 | * @var Width |
||
33 | */ |
||
34 | private $width; |
||
35 | |||
36 | /** |
||
37 | * The height |
||
38 | * |
||
39 | * @var Height |
||
40 | */ |
||
41 | private $height; |
||
42 | |||
43 | public function __construct(Width $width, Height $height) |
||
48 | |||
49 | /** |
||
50 | * Sets the width |
||
51 | * |
||
52 | * @param Width $width |
||
53 | * |
||
54 | * @return void |
||
55 | */ |
||
56 | private function setWidth(Width $width) |
||
60 | |||
61 | /** |
||
62 | * Sets the height |
||
63 | * |
||
64 | * @param Height $height |
||
65 | * |
||
66 | * @return void |
||
67 | */ |
||
68 | private function setHeight(Height $height) |
||
72 | |||
73 | /** |
||
74 | * Getter for width |
||
75 | * |
||
76 | * @return Width |
||
77 | */ |
||
78 | public function getWidth() |
||
82 | |||
83 | /** |
||
84 | * Getter for height |
||
85 | * |
||
86 | * @return Height |
||
87 | */ |
||
88 | public function getHeight() |
||
92 | |||
93 | /** |
||
94 | * Creates a new instance from given Dimensions object |
||
95 | * |
||
96 | * @param Dimensions $dimensions |
||
97 | * |
||
98 | * @return Dimensions |
||
99 | */ |
||
100 | public static function fromDimensions(Dimensions $dimensions) |
||
107 | |||
108 | /** |
||
109 | * @inheritDoc |
||
110 | * |
||
111 | * @return string |
||
112 | */ |
||
113 | public function jsonSerialize() |
||
120 | |||
121 | /** |
||
122 | * Returns string representation |
||
123 | * |
||
124 | * @return string |
||
125 | */ |
||
126 | public function __toString() |
||
134 | } |
||
135 |