@@ -91,11 +91,13 @@ discard block |
||
91 | 91 | */ |
92 | 92 | protected function loadImage(string $backgroundImagePath) |
93 | 93 | { |
94 | - if (!file_exists($backgroundImagePath)) |
|
95 | - throw new ImageNotFoundException(); |
|
94 | + if (!file_exists($backgroundImagePath)) { |
|
95 | + throw new ImageNotFoundException(); |
|
96 | + } |
|
96 | 97 | $this->image = imagecreatefrompng($backgroundImagePath); |
97 | - if ($this->image == null) |
|
98 | - throw new ImageNotLoadedException(); |
|
98 | + if ($this->image == null) { |
|
99 | + throw new ImageNotLoadedException(); |
|
100 | + } |
|
99 | 101 | list($this->imageWidth, $this->imageHeight) = getimagesize($backgroundImagePath); |
100 | 102 | } |
101 | 103 | |
@@ -134,8 +136,9 @@ discard block |
||
134 | 136 | */ |
135 | 137 | protected function prepareRows(): void |
136 | 138 | { |
137 | - if (!file_exists($this->font)) |
|
138 | - throw new FontNotFoundException(); |
|
139 | + if (!file_exists($this->font)) { |
|
140 | + throw new FontNotFoundException(); |
|
141 | + } |
|
139 | 142 | |
140 | 143 | $wordsArray = explode(' ', $this->text); |
141 | 144 | $validRowWidth = $this->imageWidth - $this->positionX * 2; |
@@ -200,8 +203,9 @@ discard block |
||
200 | 203 | { |
201 | 204 | $colorInHex = str_replace('#', '', $colorInHex); |
202 | 205 | |
203 | - if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) |
|
204 | - throw new InvalidHexColorException(); |
|
206 | + if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) { |
|
207 | + throw new InvalidHexColorException(); |
|
208 | + } |
|
205 | 209 | |
206 | 210 | $red = intval(hexdec(substr($colorInHex, 0, 2)))); |
207 | 211 | $green = intval(hexdec(substr($colorInHex, 2, 2))); |
@@ -218,8 +222,9 @@ discard block |
||
218 | 222 | public |
219 | 223 | function setFontSize(int $size) |
220 | 224 | { |
221 | - if ($size < 1 || $size > 20) |
|
222 | - throw new InvalidFontSizeException(); |
|
225 | + if ($size < 1 || $size > 20) { |
|
226 | + throw new InvalidFontSizeException(); |
|
227 | + } |
|
223 | 228 | $this->fontSizeInPercents = $size; |
224 | 229 | return $this; |
225 | 230 | } |
@@ -232,8 +237,9 @@ discard block |
||
232 | 237 | public |
233 | 238 | function setPadding(int $percent) |
234 | 239 | { |
235 | - if ($percent < 1 || $percent > 100) |
|
236 | - throw new InvalidPositionValueException(); |
|
240 | + if ($percent < 1 || $percent > 100) { |
|
241 | + throw new InvalidPositionValueException(); |
|
242 | + } |
|
237 | 243 | $this->paddingLeftRightInPercents = $percent; |
238 | 244 | return $this; |
239 | 245 | } |
@@ -245,8 +251,9 @@ discard block |
||
245 | 251 | */ |
246 | 252 | public function setMarginTopInPercents(int $percent) |
247 | 253 | { |
248 | - if ($percent < 1 || $percent > 100) |
|
249 | - throw new InvalidPositionValueException(); |
|
254 | + if ($percent < 1 || $percent > 100) { |
|
255 | + throw new InvalidPositionValueException(); |
|
256 | + } |
|
250 | 257 | $this->marginTopInPercents = $percent; |
251 | 258 | return $this; |
252 | 259 | } |
@@ -259,8 +266,9 @@ discard block |
||
259 | 266 | public |
260 | 267 | function setRowHeight(int $percent) |
261 | 268 | { |
262 | - if ($percent < 1 || $percent > 30) |
|
263 | - throw new InvalidRowHeightException(); |
|
269 | + if ($percent < 1 || $percent > 30) { |
|
270 | + throw new InvalidRowHeightException(); |
|
271 | + } |
|
264 | 272 | $this->rowHeight = $percent; |
265 | 273 | return $this; |
266 | 274 | } |