Skip to content

Commit 55b051d

Browse files
committed
internal constants are PascalCase
1 parent 223a423 commit 55b051d

File tree

3 files changed

+14
-14
lines changed

3 files changed

+14
-14
lines changed

src/Mail/Message.php

+5-5
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ private function createAttachment(
309309

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

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

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

374374
return $mail;

src/Mail/MimePart.php

+8-8
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

+1-1
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Assert::match(<<<'EOD'
5050

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

5656
Assert::match(<<<'EOD'

0 commit comments

Comments
 (0)