2
0
forked from Wavyzz/dolibarr

FIX: Update swiftmailer librairies

This commit is contained in:
kamel
2021-12-07 17:11:34 +01:00
parent bd52613331
commit 1ca199d796
156 changed files with 2370 additions and 1637 deletions

View File

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