Skip to content

Commit 202657a

Browse files
committed
internal constants are PascalCase
1 parent 21ae59d commit 202657a

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/Mail/Message.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ private function createAttachment(
310310

311311
$part->setBody($content);
312312
$part->setContentType($contentType);
313-
$part->setEncoding(preg_match('#(multipart|message)/#A', $contentType) ? self::ENCODING_8BIT : self::ENCODING_BASE64);
313+
$part->setEncoding(preg_match('#(multipart|message)/#A', $contentType) ? self::Encoding8Bit : self::EncodingBase64);
314314
$part->setHeader('Content-Disposition', $disposition . '; filename="' . addcslashes($file, '"\\') . '"');
315315
return $part;
316316
}
@@ -359,17 +359,17 @@ public function build(): static
359359

360360
$alt->setContentType('text/html', 'UTF-8')
361361
->setEncoding(preg_match('#[^\n]{990}#', $mail->htmlBody)
362-
? self::ENCODING_QUOTED_PRINTABLE
363-
: (preg_match('#[\x80-\xFF]#', $mail->htmlBody) ? self::ENCODING_8BIT : self::ENCODING_7BIT))
362+
? self::EncodingQuotedPrintable
363+
: (preg_match('#[\x80-\xFF]#', $mail->htmlBody) ? self::Encoding8Bit : self::Encoding7Bit))
364364
->setBody($mail->htmlBody);
365365
}
366366

367367
$text = $mail->getBody();
368368
$mail->setBody('');
369369
$cursor->setContentType('text/plain', 'UTF-8')
370370
->setEncoding(preg_match('#[^\n]{990}#', $text)
371-
? self::ENCODING_QUOTED_PRINTABLE
372-
: (preg_match('#[\x80-\xFF]#', $text) ? self::ENCODING_8BIT : self::ENCODING_7BIT))
371+
? self::EncodingQuotedPrintable
372+
: (preg_match('#[\x80-\xFF]#', $text) ? self::Encoding8Bit : self::Encoding7Bit))
373373
->setBody($text);
374374

375375
return $mail;

src/Mail/MimePart.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,10 @@ class MimePart
2424

2525
/** encoding */
2626
public const
27-
ENCODING_BASE64 = 'base64',
28-
ENCODING_7BIT = '7bit',
29-
ENCODING_8BIT = '8bit',
30-
ENCODING_QUOTED_PRINTABLE = 'quoted-printable';
27+
EncodingBase64 = 'base64',
28+
Encoding7Bit = '7bit',
29+
Encoding8Bit = '8bit',
30+
EncodingQuotedPrintable = 'quoted-printable';
3131

3232
/** @internal */
3333
public const EOL = "\r\n";
@@ -233,19 +233,19 @@ public function getEncodedMessage(): string
233233
$body = $this->body;
234234
if ($body !== '') {
235235
switch ($this->getEncoding()) {
236-
case self::ENCODING_QUOTED_PRINTABLE:
236+
case self::EncodingQuotedPrintable:
237237
$output .= quoted_printable_encode($body);
238238
break;
239239

240-
case self::ENCODING_BASE64:
240+
case self::EncodingBase64:
241241
$output .= rtrim(chunk_split(base64_encode($body), self::LineLength, self::EOL));
242242
break;
243243

244-
case self::ENCODING_7BIT:
244+
case self::Encoding7Bit:
245245
$body = preg_replace('#[\x80-\xFF]+#', '', $body);
246246
// break omitted
247247

248-
case self::ENCODING_8BIT:
248+
case self::Encoding8Bit:
249249
$body = str_replace(["\x00", "\r"], '', $body);
250250
$body = str_replace("\n", self::EOL, $body);
251251
$output .= $body;

tests/Mail/Mail.attachment.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Assert::match(<<<'EOD'
4949

5050
$mail = new Message;
5151
$mail->addAttachment(__DIR__ . '/fixtures/example.zip', null, 'application/zip')
52-
->setEncoding(Message::ENCODING_QUOTED_PRINTABLE);
52+
->setEncoding(Message::EncodingQuotedPrintable);
5353
$mailer->send($mail);
5454

5555
Assert::match(<<<'EOD'

0 commit comments

Comments
 (0)