@@ -90,8 +90,9 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | protected function loadImage(string $backgroundImagePath) |
| 92 | 92 | { |
| 93 | - if (!file_exists($backgroundImagePath)) |
|
| 94 | - throw new ImageNotFoundException(); |
|
| 93 | + if (!file_exists($backgroundImagePath)) { |
|
| 94 | + throw new ImageNotFoundException(); |
|
| 95 | + } |
|
| 95 | 96 | $this->image = imagecreatefrompng($backgroundImagePath); |
| 96 | 97 | list($this->imageWidth, $this->imageHeight) = getimagesize($backgroundImagePath); |
| 97 | 98 | } |
@@ -131,8 +132,9 @@ discard block |
||
| 131 | 132 | */ |
| 132 | 133 | protected function prepareRows(): void |
| 133 | 134 | { |
| 134 | - if (!file_exists($this->font)) |
|
| 135 | - throw new FontNotFoundException(); |
|
| 135 | + if (!file_exists($this->font)) { |
|
| 136 | + throw new FontNotFoundException(); |
|
| 137 | + } |
|
| 136 | 138 | |
| 137 | 139 | $wordsArray = explode(' ', $this->text); |
| 138 | 140 | $validRowWidth = $this->imageWidth - $this->positionX * 2; |
@@ -197,8 +199,9 @@ discard block |
||
| 197 | 199 | { |
| 198 | 200 | $colorInHex = str_replace('#', '', $colorInHex); |
| 199 | 201 | |
| 200 | - if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) |
|
| 201 | - throw new InvalidHexColorException(); |
|
| 202 | + if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) { |
|
| 203 | + throw new InvalidHexColorException(); |
|
| 204 | + } |
|
| 202 | 205 | |
| 203 | 206 | $red = hexdec(substr($colorInHex, 0, 2)); |
| 204 | 207 | $green = hexdec(substr($colorInHex, 2, 2)); |
@@ -215,8 +218,9 @@ discard block |
||
| 215 | 218 | public |
| 216 | 219 | function setFontSize(int $size) |
| 217 | 220 | { |
| 218 | - if ($size < 1 || $size > 20) |
|
| 219 | - throw new InvalidFontSizeException(); |
|
| 221 | + if ($size < 1 || $size > 20) { |
|
| 222 | + throw new InvalidFontSizeException(); |
|
| 223 | + } |
|
| 220 | 224 | $this->fontSizeInPercents = $size; |
| 221 | 225 | return $this; |
| 222 | 226 | } |
@@ -229,8 +233,9 @@ discard block |
||
| 229 | 233 | public |
| 230 | 234 | function setWordsPerRow(int $wordsPerRow) |
| 231 | 235 | { |
| 232 | - if ($wordsPerRow < 1 || $wordsPerRow > 30) |
|
| 233 | - throw new InvalidWordPerPageException(); |
|
| 236 | + if ($wordsPerRow < 1 || $wordsPerRow > 30) { |
|
| 237 | + throw new InvalidWordPerPageException(); |
|
| 238 | + } |
|
| 234 | 239 | $this->wordsPerRow = $wordsPerRow; |
| 235 | 240 | return $this; |
| 236 | 241 | } |
@@ -243,8 +248,9 @@ discard block |
||
| 243 | 248 | public |
| 244 | 249 | function setPadding(int $percent) |
| 245 | 250 | { |
| 246 | - if ($percent < 1 || $percent > 100) |
|
| 247 | - throw new InvalidPositionValueException(); |
|
| 251 | + if ($percent < 1 || $percent > 100) { |
|
| 252 | + throw new InvalidPositionValueException(); |
|
| 253 | + } |
|
| 248 | 254 | $this->paddingLeftRightInPercents = $percent; |
| 249 | 255 | return $this; |
| 250 | 256 | } |
@@ -256,8 +262,9 @@ discard block |
||
| 256 | 262 | */ |
| 257 | 263 | public function setMarginTopInPercents(int $percent) |
| 258 | 264 | { |
| 259 | - if ($percent < 1 || $percent > 100) |
|
| 260 | - throw new InvalidPositionValueException(); |
|
| 265 | + if ($percent < 1 || $percent > 100) { |
|
| 266 | + throw new InvalidPositionValueException(); |
|
| 267 | + } |
|
| 261 | 268 | $this->marginTopInPercents = $percent; |
| 262 | 269 | return $this; |
| 263 | 270 | } |
@@ -270,8 +277,9 @@ discard block |
||
| 270 | 277 | public |
| 271 | 278 | function setRowHeight(int $percent) |
| 272 | 279 | { |
| 273 | - if ($percent < 1 || $percent > 30) |
|
| 274 | - throw new InvalidRowHeightException(); |
|
| 280 | + if ($percent < 1 || $percent > 30) { |
|
| 281 | + throw new InvalidRowHeightException(); |
|
| 282 | + } |
|
| 275 | 283 | $this->rowHeight = $percent; |
| 276 | 284 | return $this; |
| 277 | 285 | } |