Completed
Branch master (41f794)
by Evgenii
06:52
created
Category
src/Imagenator.php 1 patch
Braces   +21 added lines, -14 removed lines patch added patch discarded remove patch
@@ -73,8 +73,9 @@  discard block
 block discarded – undo
73 73
      */
74 74
     protected function loadImage(string $backgroundImagePath)
75 75
     {
76
-        if (!file_exists($backgroundImagePath))
77
-            throw new ImageNotFoundException();
76
+        if (!file_exists($backgroundImagePath)) {
77
+                    throw new ImageNotFoundException();
78
+        }
78 79
         $this->image = imagecreatefrompng($backgroundImagePath);
79 80
         list($this->imageWidth, $this->imageHeight) = getimagesize($backgroundImagePath);
80 81
     }
@@ -104,8 +105,9 @@  discard block
 block discarded – undo
104 105
      */
105 106
     protected function putTextToImage(): void
106 107
     {
107
-        if (!file_exists($this->font))
108
-            throw new FontNotFoundException();
108
+        if (!file_exists($this->font)) {
109
+                    throw new FontNotFoundException();
110
+        }
109 111
 
110 112
         $wordsArray = explode(' ', $this->text);
111 113
         $strings = array_chunk($wordsArray, $this->wordsPerPage);
@@ -150,8 +152,9 @@  discard block
 block discarded – undo
150 152
     {
151 153
         $colorInHex = str_replace('#', '', $colorInHex);
152 154
 
153
-        if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6)
154
-            throw new InvalidHexColorException();
155
+        if (!ctype_xdigit($colorInHex) || strlen($colorInHex) !== 6) {
156
+                    throw new InvalidHexColorException();
157
+        }
155 158
 
156 159
         $red = hexdec(substr($colorInHex, 0, 2));
157 160
         $green = hexdec(substr($colorInHex, 2, 2));
@@ -167,8 +170,9 @@  discard block
 block discarded – undo
167 170
      */
168 171
     public function setFontSize(int $size)
169 172
     {
170
-        if ($size < 1 || $size > 20)
171
-            throw new InvalidFontSizeExceptionAlias();
173
+        if ($size < 1 || $size > 20) {
174
+                    throw new InvalidFontSizeExceptionAlias();
175
+        }
172 176
         $this->fontSizeInPercents = $size;
173 177
         return $this;
174 178
     }
@@ -180,8 +184,9 @@  discard block
 block discarded – undo
180 184
      */
181 185
     public function setWordsPerPage(int $wordsPerPage)
182 186
     {
183
-        if ($wordsPerPage < 1 || $wordsPerPage > 30)
184
-            throw new InvalidWordPerPageException();
187
+        if ($wordsPerPage < 1 || $wordsPerPage > 30) {
188
+                    throw new InvalidWordPerPageException();
189
+        }
185 190
         $this->wordsPerPage = $wordsPerPage;
186 191
         return $this;
187 192
     }
@@ -193,8 +198,9 @@  discard block
 block discarded – undo
193 198
      */
194 199
     public function setPositionX(int $percent)
195 200
     {
196
-        if ($percent < 1 || $percent > 100)
197
-            throw new InvalidPositionValueException();
201
+        if ($percent < 1 || $percent > 100) {
202
+                    throw new InvalidPositionValueException();
203
+        }
198 204
         $this->textPositionPercentX = $percent;
199 205
         return $this;
200 206
     }
@@ -206,8 +212,9 @@  discard block
 block discarded – undo
206 212
      */
207 213
     public function setPositionY(int $percent)
208 214
     {
209
-        if ($percent < 1 || $percent > 100)
210
-            throw new InvalidPositionValueException();
215
+        if ($percent < 1 || $percent > 100) {
216
+                    throw new InvalidPositionValueException();
217
+        }
211 218
         $this->textPositionPercentY = $percent;
212 219
         return $this;
213 220
     }
Please login to merge, or discard this patch.