@@ -103,12 +103,12 @@ discard block |
||
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); |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | $context = $twigEnvironment->mergeGlobals($data); |
118 | 118 | |
119 | 119 | if (!$template->hasBlock('subject', $context) || (!$template->hasBlock('body_html', $context) && !$template->hasBlock('body_text', $context))) { |
120 | - throw MissingBlockException::missingBlock($template->getBlockNames($context, [])); |
|
120 | + throw MissingBlockException::missingBlock($template->getBlockNames($context, [ ])); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | $subject = $template->renderBlock('subject', $data); |
@@ -139,32 +139,32 @@ discard block |
||
139 | 139 | $mail->setBody($bodyText, 'text/plain'); |
140 | 140 | } |
141 | 141 | |
142 | - if( $this->fromAddresses) { |
|
142 | + if ($this->fromAddresses) { |
|
143 | 143 | $mail->setFrom($this->fromAddresses, $this->fromName); |
144 | 144 | $mail->setSender($this->fromAddresses, $this->fromName); |
145 | 145 | } |
146 | - if( $this->toAddresses) { |
|
146 | + if ($this->toAddresses) { |
|
147 | 147 | $mail->setTo($this->toAddresses, $this->toName); |
148 | 148 | } |
149 | - if( $this->bccAddresses) { |
|
149 | + if ($this->bccAddresses) { |
|
150 | 150 | $mail->setBcc($this->bccAddresses, $this->bccName); |
151 | 151 | } |
152 | - if( $this->ccAddresses) { |
|
152 | + if ($this->ccAddresses) { |
|
153 | 153 | $mail->setCc($this->ccAddresses, $this->ccName); |
154 | 154 | } |
155 | - if( $this->replyToAddresses) { |
|
155 | + if ($this->replyToAddresses) { |
|
156 | 156 | $mail->setReplyTo($this->replyToAddresses, $this->replyToName); |
157 | 157 | } |
158 | - if( $this->maxLineLength) { |
|
158 | + if ($this->maxLineLength) { |
|
159 | 159 | $mail->setMaxLineLength($this->maxLineLength); |
160 | 160 | } |
161 | - if( $this->priority) { |
|
161 | + if ($this->priority) { |
|
162 | 162 | $mail->setPriority($this->priority); |
163 | 163 | } |
164 | - if( $this->readReceiptTo) { |
|
164 | + if ($this->readReceiptTo) { |
|
165 | 165 | $mail->setReadReceiptTo($this->readReceiptTo); |
166 | 166 | } |
167 | - if( $this->returnPath) { |
|
167 | + if ($this->returnPath) { |
|
168 | 168 | $mail->setReturnPath($this->returnPath); |
169 | 169 | } |
170 | 170 | |
@@ -309,15 +309,15 @@ discard block |
||
309 | 309 | if (strlen($expand) > 0) { |
310 | 310 | $e = explode('|', $expand); |
311 | 311 | $count = count($e); |
312 | - $pos = []; |
|
313 | - $len = []; |
|
314 | - for ($i = 0;$i < $count;++$i) { |
|
315 | - while (stripos($s, '<'.$e[$i]) > 0) { |
|
316 | - $len[1] = strlen('<'.$e[$i]); |
|
317 | - $pos[1] = stripos($s, '<'.$e[$i]); |
|
318 | - $pos[2] = stripos($s, $e[$i].'>', $pos[1] + $len[1]); |
|
319 | - $len[2] = $pos[2] - $pos[1] + $len[1]; |
|
320 | - $x = substr($s, $pos[1], $len[2]); |
|
312 | + $pos = [ ]; |
|
313 | + $len = [ ]; |
|
314 | + for ($i = 0; $i < $count; ++$i) { |
|
315 | + while (stripos($s, '<'.$e[ $i ]) > 0) { |
|
316 | + $len[ 1 ] = strlen('<'.$e[ $i ]); |
|
317 | + $pos[ 1 ] = stripos($s, '<'.$e[ $i ]); |
|
318 | + $pos[ 2 ] = stripos($s, $e[ $i ].'>', $pos[ 1 ] + $len[ 1 ]); |
|
319 | + $len[ 2 ] = $pos[ 2 ] - $pos[ 1 ] + $len[ 1 ]; |
|
320 | + $x = substr($s, $pos[ 1 ], $len[ 2 ]); |
|
321 | 321 | $s = str_replace($x, '', $s); |
322 | 322 | } |
323 | 323 | } |
@@ -343,13 +343,13 @@ discard block |
||
343 | 343 | */ |
344 | 344 | private function removeElement(string $s, string $openTag, string $closeTag) |
345 | 345 | { |
346 | - $pos = []; |
|
347 | - $len = []; |
|
346 | + $pos = [ ]; |
|
347 | + $len = [ ]; |
|
348 | 348 | while (stripos($s, $openTag) > 0) { |
349 | - $pos[1] = stripos($s, $openTag); |
|
350 | - $pos[2] = stripos($s, $closeTag, $pos[1]); |
|
351 | - $len[1] = $pos[2] - $pos[1] + 1; |
|
352 | - $x = substr($s, $pos[1], $len[1]); |
|
349 | + $pos[ 1 ] = stripos($s, $openTag); |
|
350 | + $pos[ 2 ] = stripos($s, $closeTag, $pos[ 1 ]); |
|
351 | + $len[ 1 ] = $pos[ 2 ] - $pos[ 1 ] + 1; |
|
352 | + $x = substr($s, $pos[ 1 ], $len[ 1 ]); |
|
353 | 353 | $s = str_replace($x, '', $s); |
354 | 354 | } |
355 | 355 | |
@@ -367,9 +367,9 @@ discard block |
||
367 | 367 | private function keepTag(string $s, array $tagToKeep, string $initial, string $finalize):string |
368 | 368 | { |
369 | 369 | $count = count($tagToKeep); |
370 | - for ($i = 0;$i < $count;++$i) { |
|
371 | - $s = str_replace($initial.$tagToKeep[$i], $finalize.$tagToKeep[$i], $s); |
|
372 | - $s = str_replace($initial.'/'.$tagToKeep[$i], $finalize.'/'.$tagToKeep[$i], $s); |
|
370 | + for ($i = 0; $i < $count; ++$i) { |
|
371 | + $s = str_replace($initial.$tagToKeep[ $i ], $finalize.$tagToKeep[ $i ], $s); |
|
372 | + $s = str_replace($initial.'/'.$tagToKeep[ $i ], $finalize.'/'.$tagToKeep[ $i ], $s); |
|
373 | 373 | } |
374 | 374 | |
375 | 375 | return $s; |