Total Complexity | 5 |
Total Lines | 94 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
23 | class Axis |
||
24 | { |
||
25 | /** |
||
26 | * Axis::$x |
||
27 | * |
||
28 | * Image x axis. |
||
29 | * |
||
30 | * @var int |
||
31 | */ |
||
32 | protected $x = 0; |
||
33 | |||
34 | /** |
||
35 | * Axis::$y |
||
36 | * |
||
37 | * Image y axis. |
||
38 | * |
||
39 | * @var int |
||
40 | */ |
||
41 | protected $y = 0; |
||
42 | |||
43 | // ------------------------------------------------------------------------ |
||
44 | |||
45 | /** |
||
46 | * Axis::__construct |
||
47 | * |
||
48 | * @param int $x Image x axis. |
||
49 | * @param int $y Image y axis. |
||
50 | */ |
||
51 | public function __construct($x = 0, $y = 0) |
||
52 | { |
||
53 | $this->x = (int)$x; |
||
54 | $this->y = (int)$y; |
||
55 | } |
||
56 | |||
57 | // ------------------------------------------------------------------------ |
||
58 | |||
59 | /** |
||
60 | * Axis::withX |
||
61 | * |
||
62 | * Gets image axis with new x axis. |
||
63 | * |
||
64 | * @return static |
||
65 | */ |
||
66 | public function withX($x) |
||
67 | { |
||
68 | $newAxis = clone $this; |
||
69 | $newAxis->x = (int)$x; |
||
70 | |||
71 | return $newAxis; |
||
72 | } |
||
73 | |||
74 | // ------------------------------------------------------------------------ |
||
75 | |||
76 | /** |
||
77 | * Axis::withY |
||
78 | * |
||
79 | * Gets image axis with new y axis. |
||
80 | * |
||
81 | * @return static |
||
82 | */ |
||
83 | public function withY($y) |
||
84 | { |
||
85 | $newAxis = clone $this; |
||
86 | $newAxis->y = (int)$y; |
||
87 | |||
88 | return $newAxis; |
||
89 | } |
||
90 | |||
91 | // ------------------------------------------------------------------------ |
||
92 | |||
93 | /** |
||
94 | * Axis::getX |
||
95 | * |
||
96 | * Gets image x axis. |
||
97 | * |
||
98 | * @return int |
||
99 | */ |
||
100 | public function getX() |
||
101 | { |
||
102 | return $this->x; |
||
103 | } |
||
104 | |||
105 | // ------------------------------------------------------------------------ |
||
106 | |||
107 | /** |
||
108 | * Axis::getY |
||
109 | * |
||
110 | * Gets image y axis. |
||
111 | * |
||
112 | * @return int |
||
113 | */ |
||
114 | public function getY() |
||
117 | } |
||
118 | } |