@@ -74,8 +74,9 @@ discard block |
||
| 74 | 74 | */ |
| 75 | 75 | protected function loadImage(string $backgroundImagePath) |
| 76 | 76 | { |
| 77 | - if (!file_exists($backgroundImagePath)) |
|
| 78 | - throw new ImageNotFoundException(); |
|
| 77 | + if (!file_exists($backgroundImagePath)) { |
|
| 78 | + throw new ImageNotFoundException(); |
|
| 79 | + } |
|
| 79 | 80 | $this->image = imagecreatefrompng($backgroundImagePath); |
| 80 | 81 | list($this->imageWidth, $this->imageHeight) = getimagesize($backgroundImagePath); |
| 81 | 82 | } |
@@ -105,8 +106,9 @@ discard block |
||
| 105 | 106 | */ |
| 106 | 107 | protected function putTextToImage(): void |
| 107 | 108 | { |
| 108 | - if (!file_exists($this->font)) |
|
| 109 | - throw new FontNotFoundException(); |
|
| 109 | + if (!file_exists($this->font)) { |
|
| 110 | + throw new FontNotFoundException(); |
|
| 111 | + } |
|
| 110 | 112 | |
| 111 | 113 | $wordsArray = explode(' ', $this->text); |
| 112 | 114 | $rows = array_chunk($wordsArray, $this->wordsPerRow); |
@@ -166,8 +168,9 @@ discard block |
||
| 166 | 168 | { |
| 167 | 169 | $colorInHex = str_replace('#', '', $colorInHex); |
| 168 | 170 | |
| 169 | - if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) |
|
| 170 | - throw new InvalidHexColorException(); |
|
| 171 | + if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) { |
|
| 172 | + throw new InvalidHexColorException(); |
|
| 173 | + } |
|
| 171 | 174 | |
| 172 | 175 | $red = hexdec(substr($colorInHex, 0, 2)); |
| 173 | 176 | $green = hexdec(substr($colorInHex, 2, 2)); |
@@ -183,8 +186,9 @@ discard block |
||
| 183 | 186 | */ |
| 184 | 187 | public function setFontSize(int $size) |
| 185 | 188 | { |
| 186 | - if ($size < 1 || $size > 20) |
|
| 187 | - throw new InvalidFontSizeExceptionAlias(); |
|
| 189 | + if ($size < 1 || $size > 20) { |
|
| 190 | + throw new InvalidFontSizeExceptionAlias(); |
|
| 191 | + } |
|
| 188 | 192 | $this->fontSizeInPercents = $size; |
| 189 | 193 | return $this; |
| 190 | 194 | } |
@@ -196,8 +200,9 @@ discard block |
||
| 196 | 200 | */ |
| 197 | 201 | public function setWordsPerRow(int $wordsPerRow) |
| 198 | 202 | { |
| 199 | - if ($wordsPerRow < 1 || $wordsPerRow > 30) |
|
| 200 | - throw new InvalidWordPerPageException(); |
|
| 203 | + if ($wordsPerRow < 1 || $wordsPerRow > 30) { |
|
| 204 | + throw new InvalidWordPerPageException(); |
|
| 205 | + } |
|
| 201 | 206 | $this->wordsPerRow = $wordsPerRow; |
| 202 | 207 | return $this; |
| 203 | 208 | } |
@@ -209,8 +214,9 @@ discard block |
||
| 209 | 214 | */ |
| 210 | 215 | public function setPositionX(int $percent) |
| 211 | 216 | { |
| 212 | - if ($percent < 1 || $percent > 100) |
|
| 213 | - throw new InvalidPositionValueException(); |
|
| 217 | + if ($percent < 1 || $percent > 100) { |
|
| 218 | + throw new InvalidPositionValueException(); |
|
| 219 | + } |
|
| 214 | 220 | $this->textPositionPercentX = $percent; |
| 215 | 221 | return $this; |
| 216 | 222 | } |
@@ -222,8 +228,9 @@ discard block |
||
| 222 | 228 | */ |
| 223 | 229 | public function setPositionY(int $percent) |
| 224 | 230 | { |
| 225 | - if ($percent < 1 || $percent > 100) |
|
| 226 | - throw new InvalidPositionValueException(); |
|
| 231 | + if ($percent < 1 || $percent > 100) { |
|
| 232 | + throw new InvalidPositionValueException(); |
|
| 233 | + } |
|
| 227 | 234 | $this->textPositionPercentY = $percent; |
| 228 | 235 | return $this; |
| 229 | 236 | } |
@@ -235,8 +242,9 @@ discard block |
||
| 235 | 242 | */ |
| 236 | 243 | public function setRowHeight(int $percent) |
| 237 | 244 | { |
| 238 | - if ($percent < 1 || $percent > 30) |
|
| 239 | - throw new InvalidRowHeightException(); |
|
| 245 | + if ($percent < 1 || $percent > 30) { |
|
| 246 | + throw new InvalidRowHeightException(); |
|
| 247 | + } |
|
| 240 | 248 | $this->rowHeight = $percent; |
| 241 | 249 | return $this; |
| 242 | 250 | } |