forked from Wavyzz/dolibarr
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -34,7 +34,7 @@ class Swift_Encoder_Base64Encoder implements Swift_Encoder
|
||||
$maxLineLength = 76;
|
||||
}
|
||||
|
||||
$encodedString = base64_encode($string);
|
||||
$encodedString = base64_encode($string ?? '');
|
||||
$firstLine = '';
|
||||
|
||||
if (0 != $firstLineOffset) {
|
||||
|
||||
@@ -36,7 +36,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected static $qpMap = array(
|
||||
protected static $qpMap = [
|
||||
0 => '=00', 1 => '=01', 2 => '=02', 3 => '=03', 4 => '=04',
|
||||
5 => '=05', 6 => '=06', 7 => '=07', 8 => '=08', 9 => '=09',
|
||||
10 => '=0A', 11 => '=0B', 12 => '=0C', 13 => '=0D', 14 => '=0E',
|
||||
@@ -89,16 +89,16 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
245 => '=F5', 246 => '=F6', 247 => '=F7', 248 => '=F8', 249 => '=F9',
|
||||
250 => '=FA', 251 => '=FB', 252 => '=FC', 253 => '=FD', 254 => '=FE',
|
||||
255 => '=FF',
|
||||
);
|
||||
];
|
||||
|
||||
protected static $safeMapShare = array();
|
||||
protected static $safeMapShare = [];
|
||||
|
||||
/**
|
||||
* A map of non-encoded ascii characters.
|
||||
*
|
||||
* @var string[]
|
||||
*/
|
||||
protected $safeMap = array();
|
||||
protected $safeMap = [];
|
||||
|
||||
/**
|
||||
* Creates a new QpEncoder for the given CharacterStream.
|
||||
@@ -120,7 +120,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
|
||||
public function __sleep()
|
||||
{
|
||||
return array('charStream', 'filter');
|
||||
return ['charStream', 'filter'];
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
@@ -135,14 +135,14 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
|
||||
protected function getSafeMapShareId()
|
||||
{
|
||||
return get_class($this);
|
||||
return static::class;
|
||||
}
|
||||
|
||||
protected function initSafeMap()
|
||||
{
|
||||
foreach (array_merge(
|
||||
array(0x09, 0x20), range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
|
||||
$this->safeMap[$byte] = chr($byte);
|
||||
[0x09, 0x20], range(0x21, 0x3C), range(0x3E, 0x7E)) as $byte) {
|
||||
$this->safeMap[$byte] = \chr($byte);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -153,9 +153,9 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
* If the first line needs to be shorter, indicate the difference with
|
||||
* $firstLineOffset.
|
||||
*
|
||||
* @param string $string to encode
|
||||
* @param int $firstLineOffset, optional
|
||||
* @param int $maxLineLength, optional 0 indicates the default of 76 chars
|
||||
* @param string $string to encode
|
||||
* @param int $firstLineOffset optional
|
||||
* @param int $maxLineLength optional 0 indicates the default of 76 chars
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
@@ -167,7 +167,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
|
||||
$thisLineLength = $maxLineLength - $firstLineOffset;
|
||||
|
||||
$lines = array();
|
||||
$lines = [];
|
||||
$lNo = 0;
|
||||
$lines[$lNo] = '';
|
||||
$currentLine = &$lines[$lNo++];
|
||||
@@ -200,7 +200,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
$enc = $this->encodeByteSequence($bytes, $size);
|
||||
|
||||
$i = strpos($enc, '=0D=0A');
|
||||
$newLineLength = $lineLen + ($i === false ? $size : $i);
|
||||
$newLineLength = $lineLen + (false === $i ? $size : $i);
|
||||
|
||||
if ($currentLine && $newLineLength >= $thisLineLength) {
|
||||
$lines[$lNo] = '';
|
||||
@@ -211,7 +211,7 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
|
||||
$currentLine .= $enc;
|
||||
|
||||
if ($i === false) {
|
||||
if (false === $i) {
|
||||
$lineLen += $size;
|
||||
} else {
|
||||
// 6 is the length of '=0D=0A'.
|
||||
@@ -278,10 +278,10 @@ class Swift_Encoder_QpEncoder implements Swift_Encoder
|
||||
*/
|
||||
protected function standardize($string)
|
||||
{
|
||||
$string = str_replace(array("\t=0D=0A", ' =0D=0A', '=0D=0A'),
|
||||
array("=09\r\n", "=20\r\n", "\r\n"), $string
|
||||
$string = str_replace(["\t=0D=0A", ' =0D=0A', '=0D=0A'],
|
||||
["=09\r\n", "=20\r\n", "\r\n"], $string
|
||||
);
|
||||
switch ($end = ord(substr($string, -1))) {
|
||||
switch ($end = \ord(substr($string, -1))) {
|
||||
case 0x09:
|
||||
case 0x20:
|
||||
$string = substr_replace($string, self::$qpMap[$end], -1);
|
||||
|
||||
@@ -24,8 +24,6 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
|
||||
|
||||
/**
|
||||
* Creates a new Rfc2231Encoder using the given character stream instance.
|
||||
*
|
||||
* @param Swift_CharacterStream
|
||||
*/
|
||||
public function __construct(Swift_CharacterStream $charStream)
|
||||
{
|
||||
@@ -44,7 +42,7 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
|
||||
*/
|
||||
public function encodeString($string, $firstLineOffset = 0, $maxLineLength = 0)
|
||||
{
|
||||
$lines = array();
|
||||
$lines = [];
|
||||
$lineCount = 0;
|
||||
$lines[] = '';
|
||||
$currentLine = &$lines[$lineCount++];
|
||||
@@ -60,8 +58,8 @@ class Swift_Encoder_Rfc2231Encoder implements Swift_Encoder
|
||||
|
||||
while (false !== $char = $this->charStream->read(4)) {
|
||||
$encodedChar = rawurlencode($char);
|
||||
if (0 != strlen($currentLine)
|
||||
&& strlen($currentLine.$encodedChar) > $thisLineLength) {
|
||||
if (0 != \strlen($currentLine)
|
||||
&& \strlen($currentLine.$encodedChar) > $thisLineLength) {
|
||||
$lines[] = '';
|
||||
$currentLine = &$lines[$lineCount++];
|
||||
$thisLineLength = $maxLineLength;
|
||||
|
||||
Reference in New Issue
Block a user