Test Failed
Pull Request — 5.0 (#11)
by
unknown
05:24
created
src/SwiftTwigMailTemplate.php 3 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,7 +103,7 @@  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
 
@@ -120,7 +120,7 @@  discard block
 block discarded – undo
120 120
         $context = $this->twigEnvironment->mergeGlobals($data);
121 121
 
122 122
         if (!$template->hasBlock('subject', $context) || (!$template->hasBlock('body_html', $context) && !$template->hasBlock('body_text', $context))) {
123
-            throw MissingBlockException::missingBlock($template->getBlockNames($context, []));
123
+            throw MissingBlockException::missingBlock($template->getBlockNames($context, [ ]));
124 124
         }
125 125
 
126 126
         $subject = $template->renderBlock('subject', $data);
@@ -142,32 +142,32 @@  discard block
 block discarded – undo
142 142
             $mail->setBody($bodyText, 'text/plain');
143 143
         }
144 144
 
145
-        if( $this->fromAddresses) {
145
+        if ($this->fromAddresses) {
146 146
             $mail->setFrom($this->fromAddresses, $this->fromName);
147 147
             $mail->setSender($this->fromAddresses, $this->fromName);
148 148
         }
149
-        if( $this->toAddresses) {
149
+        if ($this->toAddresses) {
150 150
             $mail->setTo($this->toAddresses, $this->toName);
151 151
         }
152
-        if( $this->bccAddresses) {
152
+        if ($this->bccAddresses) {
153 153
             $mail->setBcc($this->bccAddresses, $this->bccName);
154 154
         }
155
-        if( $this->ccAddresses) {
155
+        if ($this->ccAddresses) {
156 156
             $mail->setCc($this->ccAddresses, $this->ccName);
157 157
         }
158
-        if( $this->replyToAddresses) {
158
+        if ($this->replyToAddresses) {
159 159
             $mail->setReplyTo($this->replyToAddresses, $this->replyToName);
160 160
         }
161
-        if( $this->maxLineLength) {
161
+        if ($this->maxLineLength) {
162 162
             $mail->setMaxLineLength($this->maxLineLength);
163 163
         }
164
-        if( $this->priority) {
164
+        if ($this->priority) {
165 165
             $mail->setPriority($this->priority);
166 166
         }
167
-        if( $this->readReceiptTo) {
167
+        if ($this->readReceiptTo) {
168 168
             $mail->setReadReceiptTo($this->readReceiptTo);
169 169
         }
170
-        if( $this->returnPath) {
170
+        if ($this->returnPath) {
171 171
             $mail->setReturnPath($this->returnPath);
172 172
         }
173 173
 
@@ -313,15 +313,15 @@  discard block
 block discarded – undo
313 313
         if (strlen($expand) > 0) {
314 314
             $e = explode('|', $expand);
315 315
             $count = count($e);
316
-            $pos = [];
317
-            $len = [];
318
-            for ($i = 0;$i < $count;++$i) {
319
-                while (stripos($s, '<'.$e[$i]) > 0) {
320
-                    $len[1] = strlen('<'.$e[$i]);
321
-                    $pos[1] = stripos($s, '<'.$e[$i]);
322
-                    $pos[2] = stripos($s, $e[$i].'>', $pos[1] + $len[1]);
323
-                    $len[2] = $pos[2] - $pos[1] + $len[1];
324
-                    $x = substr($s, $pos[1], $len[2]);
316
+            $pos = [ ];
317
+            $len = [ ];
318
+            for ($i = 0; $i < $count; ++$i) {
319
+                while (stripos($s, '<'.$e[ $i ]) > 0) {
320
+                    $len[ 1 ] = strlen('<'.$e[ $i ]);
321
+                    $pos[ 1 ] = stripos($s, '<'.$e[ $i ]);
322
+                    $pos[ 2 ] = stripos($s, $e[ $i ].'>', $pos[ 1 ] + $len[ 1 ]);
323
+                    $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ];
324
+                    $x = substr($s, $pos[ 1 ], $len[ 2 ]);
325 325
                     $s = str_replace($x, '', $s);
326 326
                 }
327 327
             }
@@ -347,13 +347,13 @@  discard block
 block discarded – undo
347 347
      */
348 348
     private function removeElement(string $s, string $openTag, string $closeTag)
349 349
     {
350
-        $pos = [];
351
-        $len = [];
350
+        $pos = [ ];
351
+        $len = [ ];
352 352
         while (stripos($s, $openTag) > 0) {
353
-            $pos[1] = stripos($s, $openTag);
354
-            $pos[2] = stripos($s, $closeTag, $pos[1]);
355
-            $len[1] = $pos[2] - $pos[1] + 1;
356
-            $x = substr($s, $pos[1], $len[1]);
353
+            $pos[ 1 ] = stripos($s, $openTag);
354
+            $pos[ 2 ] = stripos($s, $closeTag, $pos[ 1 ]);
355
+            $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1;
356
+            $x = substr($s, $pos[ 1 ], $len[ 1 ]);
357 357
             $s = str_replace($x, '', $s);
358 358
         }
359 359
 
@@ -371,9 +371,9 @@  discard block
 block discarded – undo
371 371
     private function keepTag(string $s, array $tagToKeep, string $initial, string $finalize):string
372 372
     {
373 373
         $count = count($tagToKeep);
374
-        for ($i = 0;$i < $count;++$i) {
375
-            $s = str_replace($initial.$tagToKeep[$i], $finalize.$tagToKeep[$i], $s);
376
-            $s = str_replace($initial.'/'.$tagToKeep[$i], $finalize.'/'.$tagToKeep[$i], $s);
374
+        for ($i = 0; $i < $count; ++$i) {
375
+            $s = str_replace($initial.$tagToKeep[ $i ], $finalize.$tagToKeep[ $i ], $s);
376
+            $s = str_replace($initial.'/'.$tagToKeep[ $i ], $finalize.'/'.$tagToKeep[ $i ], $s);
377 377
         }
378 378
 
379 379
         return $s;
Please login to merge, or discard this patch.
Unused Use Statements   -1 removed lines patch added patch discarded remove patch
@@ -2,7 +2,6 @@
 block discarded – undo
2 2
 
3 3
 namespace TheCodingMachine\Mail\Template;
4 4
 
5
-use Mouf\Html\Renderer\Twig\TwigTemplate;
6 5
 use TheCodingMachine\Mail\SwiftMailTemplate;
7 6
 
8 7
 class SwiftTwigMailTemplate implements SwiftMailTemplate
Please login to merge, or discard this patch.
src/TwigMailExtension.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
     /**
11 11
      * @var Swift_Message[]
12 12
      */
13
-    private $messages = [];
13
+    private $messages = [ ];
14 14
 
15 15
     public function pushMessage(Swift_Message $message)
16 16
     {
17
-        $this->messages[] = $message;
17
+        $this->messages[ ] = $message;
18 18
     }
19 19
 
20 20
     public function popMessage(): Swift_Message
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     private function getMessage(): Swift_Message
26 26
     {
27
-        return $this->messages[count($this->messages)-1];
27
+        return $this->messages[ count($this->messages) - 1 ];
28 28
     }
29 29
 
30 30
     /**
@@ -35,7 +35,7 @@  discard block
 block discarded – undo
35 35
     public function getFunctions()
36 36
     {
37 37
         return [
38
-            new \Twig_SimpleFunction('embedImage', [$this, 'embedImage']),
38
+            new \Twig_SimpleFunction('embedImage', [ $this, 'embedImage' ]),
39 39
         ];
40 40
     }
41 41
 
Please login to merge, or discard this patch.