Completed
Push — 5.0 ( 37484a...137de8 )
by David
31s
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   +29 added lines, -29 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);
@@ -138,32 +138,32 @@  discard block
 block discarded – undo
138 138
             $mail->setBody($bodyText, 'text/plain');
139 139
         }
140 140
 
141
-    if( $this->fromAddresses) {
141
+    if ($this->fromAddresses) {
142 142
         $mail->setFrom($this->fromAddresses, $this->fromName);
143 143
         $mail->setSender($this->fromAddresses, $this->fromName);
144 144
     }
145
-    if( $this->toAddresses) {
145
+    if ($this->toAddresses) {
146 146
         $mail->setTo($this->toAddresses, $this->toName);
147 147
     }
148
-    if( $this->bccAddresses) {
148
+    if ($this->bccAddresses) {
149 149
         $mail->setBcc($this->bccAddresses, $this->bccName);
150 150
     }
151
-    if( $this->ccAddresses) {
151
+    if ($this->ccAddresses) {
152 152
         $mail->setCc($this->ccAddresses, $this->ccName);
153 153
     }
154
-    if( $this->replyToAddresses) {
154
+    if ($this->replyToAddresses) {
155 155
         $mail->setReplyTo($this->replyToAddresses, $this->replyToName);
156 156
     }
157
-    if( $this->maxLineLength) {
157
+    if ($this->maxLineLength) {
158 158
         $mail->setMaxLineLength($this->maxLineLength);
159 159
     }
160
-    if( $this->priority) {
160
+    if ($this->priority) {
161 161
         $mail->setPriority($this->priority);
162 162
     }
163
-    if( $this->readReceiptTo) {
163
+    if ($this->readReceiptTo) {
164 164
         $mail->setReadReceiptTo($this->readReceiptTo);
165 165
     }
166
-    if( $this->returnPath) {
166
+    if ($this->returnPath) {
167 167
         $mail->setReturnPath($this->returnPath);
168 168
     }
169 169
 
@@ -308,15 +308,15 @@  discard block
 block discarded – undo
308 308
         if (strlen($expand) > 0) {
309 309
             $e = explode('|', $expand);
310 310
             $count = count($e);
311
-            $pos = [];
312
-            $len = [];
313
-            for ($i = 0;$i < $count;++$i) {
314
-                while (stripos($s, '<'.$e[$i]) > 0) {
315
-                    $len[1] = strlen('<'.$e[$i]);
316
-                    $pos[1] = stripos($s, '<'.$e[$i]);
317
-                    $pos[2] = stripos($s, $e[$i].'>', $pos[1] + $len[1]);
318
-                    $len[2] = $pos[2] - $pos[1] + $len[1];
319
-                    $x = substr($s, $pos[1], $len[2]);
311
+            $pos = [ ];
312
+            $len = [ ];
313
+            for ($i = 0; $i < $count; ++$i) {
314
+                while (stripos($s, '<'.$e[ $i ]) > 0) {
315
+                    $len[ 1 ] = strlen('<'.$e[ $i ]);
316
+                    $pos[ 1 ] = stripos($s, '<'.$e[ $i ]);
317
+                    $pos[ 2 ] = stripos($s, $e[ $i ].'>', $pos[ 1 ] + $len[ 1 ]);
318
+                    $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ];
319
+                    $x = substr($s, $pos[ 1 ], $len[ 2 ]);
320 320
                     $s = str_replace($x, '', $s);
321 321
                 }
322 322
             }
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
      */
343 343
     private function removeElement(string $s, string $openTag, string $closeTag)
344 344
     {
345
-        $pos = [];
346
-        $len = [];
345
+        $pos = [ ];
346
+        $len = [ ];
347 347
         while (stripos($s, $openTag) > 0) {
348
-            $pos[1] = stripos($s, $openTag);
349
-            $pos[2] = stripos($s, $closeTag, $pos[1]);
350
-            $len[1] = $pos[2] - $pos[1] + 1;
351
-            $x = substr($s, $pos[1], $len[1]);
348
+            $pos[ 1 ] = stripos($s, $openTag);
349
+            $pos[ 2 ] = stripos($s, $closeTag, $pos[ 1 ]);
350
+            $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1;
351
+            $x = substr($s, $pos[ 1 ], $len[ 1 ]);
352 352
             $s = str_replace($x, '', $s);
353 353
         }
354 354
 
@@ -366,9 +366,9 @@  discard block
 block discarded – undo
366 366
     private function keepTag(string $s, array $tagToKeep, string $initial, string $finalize):string
367 367
     {
368 368
         $count = count($tagToKeep);
369
-        for ($i = 0;$i < $count;++$i) {
370
-            $s = str_replace($initial.$tagToKeep[$i], $finalize.$tagToKeep[$i], $s);
371
-            $s = str_replace($initial.'/'.$tagToKeep[$i], $finalize.'/'.$tagToKeep[$i], $s);
369
+        for ($i = 0; $i < $count; ++$i) {
370
+            $s = str_replace($initial.$tagToKeep[ $i ], $finalize.$tagToKeep[ $i ], $s);
371
+            $s = str_replace($initial.'/'.$tagToKeep[ $i ], $finalize.'/'.$tagToKeep[ $i ], $s);
372 372
         }
373 373
 
374 374
         return $s;
Please login to merge, or discard this patch.