Completed
Push — master ( b73112...a0d9bc )
by Evgenii
01:37
created
src/Imagenator.php 1 patch
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -74,8 +74,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
         $strings = array_chunk($wordsArray, $this->wordsPerRow);
@@ -151,8 +153,9 @@  discard block
 block discarded – undo
151 153
     {
152 154
         $colorInHex = str_replace('#', '', $colorInHex);
153 155
 
154
-        if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6)
155
-            throw new InvalidHexColorException();
156
+        if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) {
157
+                    throw new InvalidHexColorException();
158
+        }
156 159
 
157 160
         $red = hexdec(substr($colorInHex, 0, 2));
158 161
         $green = hexdec(substr($colorInHex, 2, 2));
@@ -168,8 +171,9 @@  discard block
 block discarded – undo
168 171
      */
169 172
     public function setFontSize(int $size)
170 173
     {
171
-        if ($size < 1 || $size > 20)
172
-            throw new InvalidFontSizeExceptionAlias();
174
+        if ($size < 1 || $size > 20) {
175
+                    throw new InvalidFontSizeExceptionAlias();
176
+        }
173 177
         $this->fontSizeInPercents = $size;
174 178
         return $this;
175 179
     }
@@ -181,8 +185,9 @@  discard block
 block discarded – undo
181 185
      */
182 186
     public function setWordsPerRow(int $wordsPerRow)
183 187
     {
184
-        if ($wordsPerRow < 1 || $wordsPerRow > 30)
185
-            throw new InvalidWordPerPageException();
188
+        if ($wordsPerRow < 1 || $wordsPerRow > 30) {
189
+                    throw new InvalidWordPerPageException();
190
+        }
186 191
         $this->wordsPerRow = $wordsPerRow;
187 192
         return $this;
188 193
     }
@@ -194,8 +199,9 @@  discard block
 block discarded – undo
194 199
      */
195 200
     public function setPositionX(int $percent)
196 201
     {
197
-        if ($percent < 1 || $percent > 100)
198
-            throw new InvalidPositionValueException();
202
+        if ($percent < 1 || $percent > 100) {
203
+                    throw new InvalidPositionValueException();
204
+        }
199 205
         $this->textPositionPercentX = $percent;
200 206
         return $this;
201 207
     }
@@ -207,8 +213,9 @@  discard block
 block discarded – undo
207 213
      */
208 214
     public function setPositionY(int $percent)
209 215
     {
210
-        if ($percent < 1 || $percent > 100)
211
-            throw new InvalidPositionValueException();
216
+        if ($percent < 1 || $percent > 100) {
217
+                    throw new InvalidPositionValueException();
218
+        }
212 219
         $this->textPositionPercentY = $percent;
213 220
         return $this;
214 221
     }
@@ -220,8 +227,9 @@  discard block
 block discarded – undo
220 227
      */
221 228
     public function setRowHeight(int $percent)
222 229
     {
223
-        if ($percent < 1 || $percent > 30)
224
-            throw new InvalidRowHeightException();
230
+        if ($percent < 1 || $percent > 30) {
231
+                    throw new InvalidRowHeightException();
232
+        }
225 233
         $this->rowHeight = $percent;
226 234
         return $this;
227 235
     }
Please login to merge, or discard this patch.