Completed
Push — 5.0 ( a6dbd7...bb6719 )
by Huberty
26s
created
src/SwiftTwigMailTemplate.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -325,7 +325,7 @@
 block discarded – undo
325 325
      * @param string $openTag
326 326
      * @param string $closeTag
327 327
      *
328
-     * @return mixed|string
328
+     * @return string
329 329
      */
330 330
     private function removeElement(string $s, string $openTag, string $closeTag)
331 331
     {
Please login to merge, or discard this patch.
Spacing   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -103,12 +103,12 @@  discard block
 block discarded – undo
103 103
      *
104 104
      * @return \Swift_Message
105 105
      */
106
-    public function renderMail(array $data = []) :\Swift_Message
106
+    public function renderMail(array $data = [ ]) :\Swift_Message
107 107
     {
108 108
         $mail = new \Swift_Message();
109 109
 
110 110
         $twigEnvironment = clone $this->twigEnvironment;
111
-        $function = new \Twig_SimpleFunction('embedImage', function ($imgPath) use ($mail) {
111
+        $function = new \Twig_SimpleFunction('embedImage', function($imgPath) use ($mail) {
112 112
             return $mail->embed(\Swift_Image::fromPath($imgPath));
113 113
         });
114 114
         $twigEnvironment->addFunction($function);
@@ -295,15 +295,15 @@  discard block
 block discarded – undo
295 295
         if (strlen($expand) > 0) {
296 296
             $e = explode('|', $expand);
297 297
             $count = count($e);
298
-            $pos = [];
299
-            $len = [];
300
-            for ($i = 0;$i < $count;++$i) {
301
-                while (stripos($s, '<'.$e[$i]) > 0) {
302
-                    $len[1] = strlen('<'.$e[$i]);
303
-                    $pos[1] = stripos($s, '<'.$e[$i]);
304
-                    $pos[2] = stripos($s, $e[$i].'>', $pos[1] + $len[1]);
305
-                    $len[2] = $pos[2] - $pos[1] + $len[1];
306
-                    $x = substr($s, $pos[1], $len[2]);
298
+            $pos = [ ];
299
+            $len = [ ];
300
+            for ($i = 0; $i < $count; ++$i) {
301
+                while (stripos($s, '<'.$e[ $i ]) > 0) {
302
+                    $len[ 1 ] = strlen('<'.$e[ $i ]);
303
+                    $pos[ 1 ] = stripos($s, '<'.$e[ $i ]);
304
+                    $pos[ 2 ] = stripos($s, $e[ $i ].'>', $pos[ 1 ] + $len[ 1 ]);
305
+                    $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ];
306
+                    $x = substr($s, $pos[ 1 ], $len[ 2 ]);
307 307
                     $s = str_replace($x, '', $s);
308 308
                 }
309 309
             }
@@ -329,13 +329,13 @@  discard block
 block discarded – undo
329 329
      */
330 330
     private function removeElement(string $s, string $openTag, string $closeTag)
331 331
     {
332
-        $pos = [];
333
-        $len = [];
332
+        $pos = [ ];
333
+        $len = [ ];
334 334
         while (stripos($s, $openTag) > 0) {
335
-            $pos[1] = stripos($s, $openTag);
336
-            $pos[2] = stripos($s, $closeTag, $pos[1]);
337
-            $len[1] = $pos[2] - $pos[1] + 1;
338
-            $x = substr($s, $pos[1], $len[1]);
335
+            $pos[ 1 ] = stripos($s, $openTag);
336
+            $pos[ 2 ] = stripos($s, $closeTag, $pos[ 1 ]);
337
+            $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1;
338
+            $x = substr($s, $pos[ 1 ], $len[ 1 ]);
339 339
             $s = str_replace($x, '', $s);
340 340
         }
341 341
 
@@ -353,9 +353,9 @@  discard block
 block discarded – undo
353 353
     private function keepTag(string $s, array $tagToKeep, string $initial, string $finalize):string
354 354
     {
355 355
         $count = count($tagToKeep);
356
-        for ($i = 0;$i < $count;++$i) {
357
-            $s = str_replace($initial.$tagToKeep[$i], $finalize.$tagToKeep[$i], $s);
358
-            $s = str_replace($initial.'/'.$tagToKeep[$i], $finalize.'/'.$tagToKeep[$i], $s);
356
+        for ($i = 0; $i < $count; ++$i) {
357
+            $s = str_replace($initial.$tagToKeep[ $i ], $finalize.$tagToKeep[ $i ], $s);
358
+            $s = str_replace($initial.'/'.$tagToKeep[ $i ], $finalize.'/'.$tagToKeep[ $i ], $s);
359 359
         }
360 360
 
361 361
         return $s;
Please login to merge, or discard this patch.