Skip to content

Commit a76c903

Browse files
committed
private constants are PascalCase
1 parent 33c42f7 commit a76c903

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

src/Mail/DkimSigner.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class DkimSigner implements Signer
1616
{
1717
use Nette\SmartObject;
1818

19-
private const DEFAULT_SIGN_HEADERS = [
19+
private const DefaultSignHeaders = [
2020
'From',
2121
'To',
2222
'Date',
@@ -26,7 +26,7 @@ class DkimSigner implements Signer
2626
'Content-Type',
2727
];
2828

29-
private const DKIM_SIGNATURE = 'DKIM-Signature';
29+
private const DkimSignature = 'DKIM-Signature';
3030

3131
/** @var string */
3232
private $domain;
@@ -45,7 +45,7 @@ class DkimSigner implements Signer
4545

4646

4747
/** @throws Nette\NotSupportedException */
48-
public function __construct(array $options, array $signHeaders = self::DEFAULT_SIGN_HEADERS)
48+
public function __construct(array $options, array $signHeaders = self::DefaultSignHeaders)
4949
{
5050
if (!extension_loaded('openssl')) {
5151
throw new Nette\NotSupportedException('DkimSigner requires PHP extension openssl which is not loaded.');
@@ -57,7 +57,7 @@ public function __construct(array $options, array $signHeaders = self::DEFAULT_S
5757
$this->passPhrase = $options['passPhrase'] ?? '';
5858
$this->signHeaders = count($signHeaders) > 0
5959
? $signHeaders
60-
: self::DEFAULT_SIGN_HEADERS;
60+
: self::DefaultSignHeaders;
6161
}
6262

6363

@@ -97,13 +97,13 @@ protected function getSignature(Message $message, string $header, string $body):
9797
$parts[] = $key . '=' . $value;
9898
}
9999

100-
return $this->computeSignature($header, self::DKIM_SIGNATURE . ': ' . implode('; ', $parts));
100+
return $this->computeSignature($header, self::DkimSignature . ': ' . implode('; ', $parts));
101101
}
102102

103103

104104
protected function computeSignature(string $rawHeader, string $signature): string
105105
{
106-
$selectedHeaders = array_merge($this->signHeaders, [self::DKIM_SIGNATURE]);
106+
$selectedHeaders = array_merge($this->signHeaders, [self::DkimSignature]);
107107

108108
$rawHeader = preg_replace("/\r\n[ \t]+/", ' ', rtrim($rawHeader, "\r\n") . "\r\n" . $signature);
109109

src/Mail/MimePart.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,11 @@ class MimePart
3232
/** @internal */
3333
public const EOL = "\r\n";
3434

35-
public const LINE_LENGTH = 76;
35+
public const LineLength = 76;
3636

3737
private const
38-
SEQUENCE_VALUE = 1, // value, RFC 2231
39-
SEQUENCE_WORD = 2; // encoded-word, RFC 2047
38+
SequenceValue = 1, // value, RFC 2231
39+
SequenceWord = 2; // encoded-word, RFC 2047
4040

4141
/** @var array */
4242
private $headers = [];
@@ -129,7 +129,7 @@ public function getEncodedHeader(string $name): ?string
129129
$s = '';
130130
foreach ($this->headers[$name] as $email => $name) {
131131
if ($name != null) { // intentionally ==
132-
$s .= self::encodeSequence($name, $offset, self::SEQUENCE_WORD);
132+
$s .= self::encodeSequence($name, $offset, self::SequenceWord);
133133
$email = " <$email>";
134134
}
135135

@@ -140,7 +140,7 @@ public function getEncodedHeader(string $name): ?string
140140

141141
} elseif (preg_match('#^(\S+; (?:file)?name=)"(.*)"$#D', $this->headers[$name], $m)) { // Content-Disposition
142142
$offset += strlen($m[1]);
143-
return $m[1] . self::encodeSequence(stripslashes($m[2]), $offset, self::SEQUENCE_VALUE);
143+
return $m[1] . self::encodeSequence(stripslashes($m[2]), $offset, self::SequenceValue);
144144

145145
} else {
146146
return ltrim(self::encodeSequence($this->headers[$name], $offset));
@@ -247,7 +247,7 @@ public function getEncodedMessage(): string
247247
break;
248248

249249
case self::ENCODING_BASE64:
250-
$output .= rtrim(chunk_split(base64_encode($body), self::LINE_LENGTH, self::EOL));
250+
$output .= rtrim(chunk_split(base64_encode($body), self::LineLength, self::EOL));
251251
break;
252252

253253
case self::ENCODING_7BIT:
@@ -290,7 +290,7 @@ public function getEncodedMessage(): string
290290
private static function encodeSequence(string $s, int &$offset = 0, ?int $type = null): string
291291
{
292292
if (
293-
(strlen($s) < self::LINE_LENGTH - 3) && // 3 is tab + quotes
293+
(strlen($s) < self::LineLength - 3) && // 3 is tab + quotes
294294
strspn($s, "!\"#$%&\\'()*+,-./0123456789:;<>@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^`abcdefghijklmnopqrstuvwxyz{|}~=? _\r\n\t") === strlen($s)
295295
) {
296296
if ($type && preg_match('#[^ a-zA-Z0-9!\#$%&\'*+/?^_`{|}~-]#', $s)) { // RFC 2822 atext except =
@@ -314,7 +314,7 @@ private static function encodeSequence(string $s, int &$offset = 0, ?int $type =
314314

315315
$offset = strlen($s) - strrpos($s, "\n");
316316
$s = substr($s, $old + 2); // adds ': '
317-
if ($type === self::SEQUENCE_VALUE) {
317+
if ($type === self::SequenceValue) {
318318
$s = '"' . $s . '"';
319319
}
320320

@@ -325,7 +325,7 @@ private static function encodeSequence(string $s, int &$offset = 0, ?int $type =
325325

326326
private static function append(string $s, int &$offset = 0): string
327327
{
328-
if ($offset + strlen($s) > self::LINE_LENGTH) {
328+
if ($offset + strlen($s) > self::LineLength) {
329329
$offset = 1;
330330
$s = self::EOL . "\t" . $s;
331331
}

0 commit comments

Comments
 (0)