@@ -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