Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
10 / 10 |
|
100.00% |
7 / 7 |
CRAP | |
100.00% |
1 / 1 |
AbstractDraw | |
100.00% |
10 / 10 |
|
100.00% |
7 / 7 |
7 | |
100.00% |
1 / 1 |
setOpacity | n/a |
0 / 0 |
n/a |
0 / 0 |
0 | |||||
getOpacity | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getFillColor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStrokeColor | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getStrokeWidth | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
setFillColor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
setStrokeColor | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
setStrokeWidth | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | /** |
3 | * Pop PHP Framework (http://www.popphp.org/) |
4 | * |
5 | * @link https://github.com/popphp/popphp-framework |
6 | * @author Nick Sagona, III <dev@nolainteractive.com> |
7 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
8 | * @license http://www.popphp.org/license New BSD License |
9 | */ |
10 | |
11 | /** |
12 | * @namespace |
13 | */ |
14 | namespace Pop\Image\Draw; |
15 | |
16 | use Pop\Image\AbstractEditObject; |
17 | use Pop\Color\Color; |
18 | |
19 | /** |
20 | * Draw abstract class |
21 | * |
22 | * @category Pop |
23 | * @package Pop\Image |
24 | * @author Nick Sagona, III <dev@nolainteractive.com> |
25 | * @copyright Copyright (c) 2009-2024 NOLA Interactive, LLC. (http://www.nolainteractive.com) |
26 | * @license http://www.popphp.org/license New BSD License |
27 | * @version 4.0.0 |
28 | */ |
29 | abstract class AbstractDraw extends AbstractEditObject implements DrawInterface |
30 | { |
31 | |
32 | /** |
33 | * Opacity |
34 | * @var int|float|null |
35 | */ |
36 | protected int|float|null $opacity = null; |
37 | |
38 | /** |
39 | * Fill color |
40 | * @var ?Color\Colorinterface |
41 | */ |
42 | protected ?Color\Colorinterface $fillColor = null; |
43 | |
44 | /** |
45 | * Stroke color |
46 | * @var ?Color\Colorinterface |
47 | */ |
48 | protected ?Color\Colorinterface$strokeColor = null; |
49 | |
50 | /** |
51 | * Stroke width |
52 | * @var int |
53 | */ |
54 | protected int $strokeWidth = 0; |
55 | |
56 | /** |
57 | * Set the opacity |
58 | * |
59 | * @param int|float $opacity |
60 | * @return AbstractDraw |
61 | */ |
62 | abstract public function setOpacity(int|float $opacity): AbstractDraw; |
63 | |
64 | /** |
65 | * Get the opacity |
66 | * |
67 | * @return mixed |
68 | */ |
69 | public function getOpacity(): mixed |
70 | { |
71 | return $this->opacity; |
72 | } |
73 | |
74 | /** |
75 | * Get fill color |
76 | * |
77 | * @return Color\Colorinterface |
78 | */ |
79 | public function getFillColor(): Color\Colorinterface |
80 | { |
81 | return $this->fillColor; |
82 | } |
83 | |
84 | /** |
85 | * Get stroke color |
86 | * |
87 | * @return Color\Colorinterface |
88 | */ |
89 | public function getStrokeColor(): Color\Colorinterface |
90 | { |
91 | return $this->strokeColor; |
92 | } |
93 | |
94 | /** |
95 | * Get stroke width |
96 | * |
97 | * @return int |
98 | */ |
99 | public function getStrokeWidth(): int |
100 | { |
101 | return $this->strokeWidth; |
102 | } |
103 | |
104 | /** |
105 | * Set fill color |
106 | * |
107 | * @param Color\ColorInterface $color |
108 | * @return AbstractDraw |
109 | */ |
110 | public function setFillColor(Color\ColorInterface $color): AbstractDraw |
111 | { |
112 | $this->fillColor = $color; |
113 | return $this; |
114 | } |
115 | |
116 | /** |
117 | * Set stroke color |
118 | * |
119 | * @param Color\ColorInterface $color |
120 | * @return AbstractDraw |
121 | */ |
122 | public function setStrokeColor(Color\ColorInterface $color): AbstractDraw |
123 | { |
124 | $this->strokeColor = $color; |
125 | return $this; |
126 | } |
127 | |
128 | /** |
129 | * Get stroke width |
130 | * |
131 | * @param int $w |
132 | * @return AbstractDraw |
133 | */ |
134 | public function setStrokeWidth(int $w): AbstractDraw |
135 | { |
136 | $this->strokeWidth = $w; |
137 | return $this; |
138 | } |
139 | |
140 | } |