Skip to content

Commit 2b47ec3

Browse files
committed
coding style: fixes in code
1 parent 0ca0229 commit 2b47ec3

16 files changed

+25
-23
lines changed

src/Bridges/MailDI/MailExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class MailExtension extends Nette\DI\CompilerExtension
2525
'password' => null,
2626
'secure' => null,
2727
'timeout' => null,
28-
'context' => null,
28+
'context' => null,
2929
];
3030

3131

src/Mail/Message.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@
2222
class Message extends MimePart
2323
{
2424
/** Priority */
25-
const HIGH = 1,
25+
public const
26+
HIGH = 1,
2627
NORMAL = 3,
2728
LOW = 5;
2829

@@ -373,7 +374,7 @@ protected function buildText(string $html): string
373374
$text = Strings::replace($html, [
374375
'#<(style|script|head).*</\\1>#Uis' => '',
375376
'#<t[dh][ >]#i' => ' $0',
376-
'#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;',
377+
'#<a\s[^>]*href=(?|"([^"]+)"|\'([^\']+)\')[^>]*>(.*?)</a>#is' => '$2 &lt;$1&gt;',
377378
'#[\r\n]+#' => ' ',
378379
'#<(/?p|/?h\d|li|br|/tr)[ >/]#i' => "\n$0",
379380
]);

src/Mail/MimePart.php

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@ class MimePart
2323
use Nette\SmartObject;
2424

2525
/** encoding */
26-
const ENCODING_BASE64 = 'base64',
26+
public const
27+
ENCODING_BASE64 = 'base64',
2728
ENCODING_7BIT = '7bit',
2829
ENCODING_8BIT = '8bit',
2930
ENCODING_QUOTED_PRINTABLE = 'quoted-printable';
3031

3132
/** @internal */
32-
const EOL = "\r\n";
33-
const LINE_LENGTH = 76;
33+
public const EOL = "\r\n";
34+
public const LINE_LENGTH = 76;
3435

3536
/** @var array */
3637
private $headers = [];
@@ -241,7 +242,7 @@ public function getEncodedMessage(): string
241242

242243
case self::ENCODING_7BIT:
243244
$body = preg_replace('#[\x80-\xFF]+#', '', $body);
244-
// break intentionally omitted
245+
// break omitted
245246

246247
case self::ENCODING_8BIT:
247248
$body = str_replace(["\x00", "\r"], '', $body);
@@ -261,7 +262,7 @@ public function getEncodedMessage(): string
261262
foreach ($this->parts as $part) {
262263
$output .= '--' . $boundary . self::EOL . $part->getEncodedMessage() . self::EOL;
263264
}
264-
$output .= '--' . $boundary.'--';
265+
$output .= '--' . $boundary . '--';
265266
}
266267

267268
return $output;

src/Mail/SmtpMailer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function send(Message $mail): void
120120
*/
121121
protected function connect(): void
122122
{
123-
$this->connection = @stream_socket_client( // @ is escalated to exception
123+
$this->connection = @stream_socket_client(// @ is escalated to exception
124124
($this->secure === 'ssl' ? 'ssl://' : '') . $this->host . ':' . $this->port,
125125
$errno, $error, $this->timeout, STREAM_CLIENT_CONNECT, $this->context
126126
);

tests/Mail/Mail.HtmlBody.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $mail->setHTMLBody('<b><span>Příliš </span> žluťoučký <br>kůň</b>');
2626
$mailer = new TestMailer();
2727
$mailer->send($mail);
2828

29-
Assert::match(<<<EOD
29+
Assert::match(<<<'EOD'
3030
MIME-Version: 1.0
3131
X-Mailer: Nette Framework
3232
Date: %a%

tests/Mail/Mail.HtmlBodyAndLinks.multiline.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ $mail->setHTMLBody('<b><span>Příliš </span> <a href="http://green.example.com
3434
$mailer = new TestMailer();
3535
$mailer->send($mail);
3636

37-
Assert::match(<<<EOD
37+
Assert::match(<<<'EOD'
3838
MIME-Version: 1.0
3939
X-Mailer: Nette Framework
4040
Date: %a%

tests/Mail/Mail.HtmlBodyAndLinks.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ $mail->setHTMLBody('<b><span>Příliš </span> <a href="http://green.example.com
2727
$mailer = new TestMailer();
2828
$mailer->send($mail);
2929

30-
Assert::match(<<<EOD
30+
Assert::match(<<<'EOD'
3131
MIME-Version: 1.0
3232
X-Mailer: Nette Framework
3333
Date: %a%

tests/Mail/Mail.attachment.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ $mail = new Message();
2121
$mail->addAttachment(__DIR__ . '/files/example.zip', null, 'application/zip');
2222
$mailer->send($mail);
2323

24-
Assert::match(<<<EOD
24+
Assert::match(<<<'EOD'
2525
MIME-Version: 1.0
2626
X-Mailer: Nette Framework
2727
Date: %a%
@@ -53,7 +53,7 @@ $mail->addAttachment(__DIR__ . '/files/example.zip', null, 'application/zip')
5353
->setEncoding(Message::ENCODING_QUOTED_PRINTABLE);
5454
$mailer->send($mail);
5555

56-
Assert::match(<<<EOD
56+
Assert::match(<<<'EOD'
5757
MIME-Version: 1.0
5858
X-Mailer: Nette Framework
5959
Date: %a%
@@ -82,7 +82,7 @@ $name = iconv('UTF-8', 'WINDOWS-1250', 'žluťoučký.zip');
8282
$mail->addAttachment($name, file_get_contents(__DIR__ . '/files/example.zip'), 'application/zip');
8383
$mailer->send($mail);
8484

85-
Assert::match(<<<EOD
85+
Assert::match(<<<'EOD'
8686
MIME-Version: 1.0
8787
X-Mailer: Nette Framework
8888
Date: %a%

tests/Mail/Mail.email.long.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ $mail->addBcc('veryveryveryveryveryveryveryveryveryveryveryveryveryveryveryveryv
2626
$mailer = new TestMailer();
2727
$mailer->send($mail);
2828

29-
Assert::match(<<<EOD
29+
Assert::match(<<<'EOD'
3030
MIME-Version: 1.0
3131
X-Mailer: Nette Framework
3232
Date: %a%

tests/Mail/Mail.email.multiple.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ $mail->setBody('Žluťoučký kůň');
2929
$mailer = new TestMailer();
3030
$mailer->send($mail);
3131

32-
Assert::match(<<<EOD
32+
Assert::match(<<<'EOD'
3333
MIME-Version: 1.0
3434
X-Mailer: Nette Framework
3535
Date: %a%

0 commit comments

Comments
 (0)