Skip to content

Commit 86d3ced

Browse files
committed
coding style
1 parent f47988b commit 86d3ced

21 files changed

+377
-396
lines changed

src/Bridges/MailDI/MailExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public function getConfigSchema(): Nette\Schema\Schema
3939
'selector' => Expect::string()->dynamic(),
4040
'privateKey' => Expect::string()->required(),
4141
'passPhrase' => Expect::string()->dynamic(),
42-
])->castTo('array')
42+
])->castTo('array'),
4343
),
4444
])->castTo('array');
4545
}

src/Mail/DkimSigner.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,8 @@ protected function computeBodyHash(string $body): string
155155
return base64_encode(
156156
pack(
157157
'H*',
158-
hash('sha256', $body)
159-
)
158+
hash('sha256', $body),
159+
),
160160
);
161161
}
162162

@@ -171,9 +171,7 @@ protected function normalizeNewLines(string $s): string
171171

172172
protected function getSignedHeaders(Message $message): array
173173
{
174-
return array_filter($this->signHeaders, function ($name) use ($message) {
175-
return $message->getHeader($name) !== null;
176-
});
174+
return array_filter($this->signHeaders, fn($name) => $message->getHeader($name) !== null);
177175
}
178176

179177

src/Mail/Message.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ public function setHtmlBody(string $html, ?string $basePath = null)
214214
(["\']?)(?![a-z]+:|[/\#])([^"\'>)\s]+)
215215
|\[\[ ([\w()+./@~-]+) \]\]
216216
#ix',
217-
PREG_OFFSET_CAPTURE
217+
PREG_OFFSET_CAPTURE,
218218
);
219219
foreach (array_reverse($matches) as $m) {
220220
$file = rtrim($basePath, '/\\') . '/' . (isset($m[4]) ? $m[4][0] : urldecode($m[3][0]));
@@ -226,7 +226,7 @@ public function setHtmlBody(string $html, ?string $basePath = null)
226226
$html,
227227
"{$m[1][0]}{$m[2][0]}cid:{$cids[$file]}",
228228
$m[0][1],
229-
strlen($m[0][0])
229+
strlen($m[0][0]),
230230
);
231231
}
232232
}
@@ -303,7 +303,7 @@ private function createAttachment(
303303
string $file,
304304
?string $content,
305305
?string $contentType,
306-
string $disposition
306+
string $disposition,
307307
): MimePart
308308
{
309309
$part = new MimePart;

src/Mail/MimePart.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ class MimePart
3434

3535
public const LineLength = 76;
3636

37+
/** value (RFC 2231), encoded-word (RFC 2047) */
3738
private const
38-
SequenceValue = 1, // value, RFC 2231
39-
SequenceWord = 2; // encoded-word, RFC 2047
39+
SequenceValue = 1,
40+
SequenceWord = 2;
4041

4142
/** @var array */
4243
private $headers = [];

src/Mail/SmtpMailer.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ public function send(Message $mail): void
125125
foreach (array_merge(
126126
(array) $mail->getHeader('To'),
127127
(array) $mail->getHeader('Cc'),
128-
(array) $mail->getHeader('Bcc')
128+
(array) $mail->getHeader('Bcc'),
129129
) as $email => $name) {
130130
$this->write("RCPT TO:<$email>", [250, 251]);
131131
}
@@ -160,7 +160,7 @@ protected function connect(): void
160160
$error,
161161
$this->timeout,
162162
STREAM_CLIENT_CONNECT,
163-
$this->context
163+
$this->context,
164164
);
165165
if (!$this->connection) {
166166
throw new SmtpException($error ?: error_get_last()['message'], $errno);
@@ -175,7 +175,7 @@ protected function connect(): void
175175
if (!stream_socket_enable_crypto(
176176
$this->connection,
177177
true,
178-
STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT
178+
STREAM_CRYPTO_METHOD_TLS_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_1_CLIENT | STREAM_CRYPTO_METHOD_TLSv1_2_CLIENT,
179179
)) {
180180
throw new SmtpException('Unable to connect via TLS.');
181181
}

tests/Mail/Mail.HtmlBody.phpt

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -27,27 +27,26 @@ $mailer = new TestMailer;
2727
$mailer->send($mail);
2828

2929
Assert::match(<<<'EOD'
30-
MIME-Version: 1.0
31-
X-Mailer: Nette Framework
32-
Date: %a%
33-
From: John Doe <[email protected]>
34-
To: Lady Jane <[email protected]>
35-
Subject: Hello Jane!
36-
Message-ID: <%S%@%S%>
37-
Content-Type: multipart/alternative;
38-
boundary="--------%S%"
39-
40-
----------%S%
41-
Content-Type: text/plain; charset=UTF-8
42-
Content-Transfer-Encoding: 8bit
43-
44-
Příliš žluťoučký
45-
kůň
46-
----------%S%
47-
Content-Type: text/html; charset=UTF-8
48-
Content-Transfer-Encoding: 8bit
49-
50-
<b><span>Příliš </span> žluťoučký <br>kůň</b>
51-
----------%S%--
52-
EOD
53-
, TestMailer::$output);
30+
MIME-Version: 1.0
31+
X-Mailer: Nette Framework
32+
Date: %a%
33+
From: John Doe <[email protected]>
34+
To: Lady Jane <[email protected]>
35+
Subject: Hello Jane!
36+
Message-ID: <%S%@%S%>
37+
Content-Type: multipart/alternative;
38+
boundary="--------%S%"
39+
40+
----------%S%
41+
Content-Type: text/plain; charset=UTF-8
42+
Content-Transfer-Encoding: 8bit
43+
44+
Příliš žluťoučký
45+
kůň
46+
----------%S%
47+
Content-Type: text/html; charset=UTF-8
48+
Content-Transfer-Encoding: 8bit
49+
50+
<b><span>Příliš </span> žluťoučký <br>kůň</b>
51+
----------%S%--
52+
EOD, TestMailer::$output);

tests/Mail/Mail.HtmlBodyAndLinks.multiline.phpt

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,34 @@ $mailer = new TestMailer;
3535
$mailer->send($mail);
3636

3737
Assert::match(<<<'EOD'
38-
MIME-Version: 1.0
39-
X-Mailer: Nette Framework
40-
Date: %a%
41-
From: John Doe <[email protected]>
42-
To: Lady Jane <[email protected]>
43-
Subject: Hello Jane!
44-
Message-ID: <%S%@%S%>
45-
Content-Type: multipart/alternative;
46-
boundary="--------%S%"
38+
MIME-Version: 1.0
39+
X-Mailer: Nette Framework
40+
Date: %a%
41+
From: John Doe <[email protected]>
42+
To: Lady Jane <[email protected]>
43+
Subject: Hello Jane!
44+
Message-ID: <%S%@%S%>
45+
Content-Type: multipart/alternative;
46+
boundary="--------%S%"
4747
48-
----------%S%
49-
Content-Type: text/plain; charset=UTF-8
50-
Content-Transfer-Encoding: 8bit
48+
----------%S%
49+
Content-Type: text/plain; charset=UTF-8
50+
Content-Transfer-Encoding: 8bit
5151
52-
Příliš žluťoučký <http://green.example.com>
53-
žlutý kůň <http://horse.example.com>
54-
----------%S%
55-
Content-Type: text/html; charset=UTF-8
56-
Content-Transfer-Encoding: 8bit
52+
Příliš žluťoučký <http://green.example.com>
53+
žlutý kůň <http://horse.example.com>
54+
----------%S%
55+
Content-Type: text/html; charset=UTF-8
56+
Content-Transfer-Encoding: 8bit
5757
58-
<b><span>Příliš </span> <a href="http://green.example.com">žluťoučký</a><br>
59-
<a
60-
href='http://horse.example.com'
61-
style="abc"
62-
>
63-
žlutý
64-
kůň
65-
</a>
66-
</b>
67-
----------%S%--
68-
EOD
69-
, TestMailer::$output);
58+
<b><span>Příliš </span> <a href="http://green.example.com">žluťoučký</a><br>
59+
<a
60+
href='http://horse.example.com'
61+
style="abc"
62+
>
63+
žlutý
64+
kůň
65+
</a>
66+
</b>
67+
----------%S%--
68+
EOD, TestMailer::$output);

tests/Mail/Mail.HtmlBodyAndLinks.phpt

Lines changed: 23 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -28,27 +28,26 @@ $mailer = new TestMailer;
2828
$mailer->send($mail);
2929

3030
Assert::match(<<<'EOD'
31-
MIME-Version: 1.0
32-
X-Mailer: Nette Framework
33-
Date: %a%
34-
From: John Doe <[email protected]>
35-
To: Lady Jane <[email protected]>
36-
Subject: Hello Jane!
37-
Message-ID: <%S%@%S%>
38-
Content-Type: multipart/alternative;
39-
boundary="--------%S%"
40-
41-
----------%S%
42-
Content-Type: text/plain; charset=UTF-8
43-
Content-Transfer-Encoding: 8bit
44-
45-
Příliš žluťoučký <http://green.example.com> "
46-
kůň <http://horse.example.com>
47-
----------%S%
48-
Content-Type: text/html; charset=UTF-8
49-
Content-Transfer-Encoding: 8bit
50-
51-
<b><span>Příliš </span> <a href="http://green.example.com">žluťoučký</a> " <br><a href='http://horse.example.com'>kůň</a></b>
52-
----------%S%--
53-
EOD
54-
, TestMailer::$output);
31+
MIME-Version: 1.0
32+
X-Mailer: Nette Framework
33+
Date: %a%
34+
From: John Doe <[email protected]>
35+
To: Lady Jane <[email protected]>
36+
Subject: Hello Jane!
37+
Message-ID: <%S%@%S%>
38+
Content-Type: multipart/alternative;
39+
boundary="--------%S%"
40+
41+
----------%S%
42+
Content-Type: text/plain; charset=UTF-8
43+
Content-Transfer-Encoding: 8bit
44+
45+
Příliš žluťoučký <http://green.example.com> "
46+
kůň <http://horse.example.com>
47+
----------%S%
48+
Content-Type: text/html; charset=UTF-8
49+
Content-Transfer-Encoding: 8bit
50+
51+
<b><span>Příliš </span> <a href="http://green.example.com">žluťoučký</a> " <br><a href='http://horse.example.com'>kůň</a></b>
52+
----------%S%--
53+
EOD, TestMailer::$output);

tests/Mail/Mail.attachment.eml.phpt

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -22,24 +22,23 @@ $mail->addAttachment(__DIR__ . '/fixtures/example.eml', null, 'MESSAGE/RFC822');
2222
$mailer->send($mail);
2323

2424
Assert::match(<<<'EOD'
25-
MIME-Version: 1.0
26-
X-Mailer: Nette Framework
27-
Date: %a%
28-
Message-ID: <%S%@%S%>
29-
Content-Type: multipart/mixed;
30-
boundary="--------%S%"
31-
32-
----------%S%
33-
Content-Type: text/plain; charset=UTF-8
34-
Content-Transfer-Encoding: 7bit
35-
36-
37-
----------%S%
38-
Content-Type: application/octet-stream
39-
Content-Transfer-Encoding: base64
40-
Content-Disposition: attachment; filename="example.eml"
41-
42-
Um%A%=
43-
----------%S%--
44-
EOD
45-
, TestMailer::$output);
25+
MIME-Version: 1.0
26+
X-Mailer: Nette Framework
27+
Date: %a%
28+
Message-ID: <%S%@%S%>
29+
Content-Type: multipart/mixed;
30+
boundary="--------%S%"
31+
32+
----------%S%
33+
Content-Type: text/plain; charset=UTF-8
34+
Content-Transfer-Encoding: 7bit
35+
36+
37+
----------%S%
38+
Content-Type: application/octet-stream
39+
Content-Transfer-Encoding: base64
40+
Content-Disposition: attachment; filename="example.eml"
41+
42+
Um%A%=
43+
----------%S%--
44+
EOD, TestMailer::$output);

0 commit comments

Comments
 (0)