forked from Wavyzz/dolibarr
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -31,10 +31,10 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
private $charset;
|
||||
|
||||
/** Array of characters */
|
||||
private $array = array();
|
||||
private $array = [];
|
||||
|
||||
/** Size of the array of character */
|
||||
private $array_size = array();
|
||||
private $array_size = [];
|
||||
|
||||
/** The current character offset in the stream */
|
||||
private $offset = 0;
|
||||
@@ -65,8 +65,6 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
|
||||
/**
|
||||
* Set the CharacterReaderFactory for multi charset support.
|
||||
*
|
||||
* @param Swift_CharacterReaderFactory $factory
|
||||
*/
|
||||
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
|
||||
{
|
||||
@@ -87,16 +85,16 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
|
||||
$startLength = $this->charReader->getInitialByteSize();
|
||||
while (false !== $bytes = $os->read($startLength)) {
|
||||
$c = array();
|
||||
for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
|
||||
$c = [];
|
||||
for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
|
||||
$c[] = self::$byteMap[$bytes[$i]];
|
||||
}
|
||||
$size = count($c);
|
||||
$size = \count($c);
|
||||
$need = $this->charReader
|
||||
->validateByteSequence($c, $size);
|
||||
if ($need > 0 &&
|
||||
false !== $bytes = $os->read($need)) {
|
||||
for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
|
||||
for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
|
||||
$c[] = self::$byteMap[$bytes[$i]];
|
||||
}
|
||||
}
|
||||
@@ -132,7 +130,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
}
|
||||
|
||||
// Don't use array slice
|
||||
$arrays = array();
|
||||
$arrays = [];
|
||||
$end = $length + $this->offset;
|
||||
for ($i = $this->offset; $i < $end; ++$i) {
|
||||
if (!isset($this->array[$i])) {
|
||||
@@ -162,7 +160,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
if ($this->offset == $this->array_size) {
|
||||
return false;
|
||||
}
|
||||
$arrays = array();
|
||||
$arrays = [];
|
||||
$end = $length + $this->offset;
|
||||
for ($i = $this->offset; $i < $end; ++$i) {
|
||||
if (!isset($this->array[$i])) {
|
||||
@@ -172,7 +170,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
}
|
||||
$this->offset += ($i - $this->offset); // Limit function calls
|
||||
|
||||
return call_user_func_array('array_merge', $arrays);
|
||||
return array_merge(...$arrays);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -194,19 +192,19 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
unset($chars);
|
||||
fseek($fp, 0, SEEK_SET);
|
||||
|
||||
$buffer = array(0);
|
||||
$buffer = [0];
|
||||
$buf_pos = 1;
|
||||
$buf_len = 1;
|
||||
$has_datas = true;
|
||||
do {
|
||||
$bytes = array();
|
||||
$bytes = [];
|
||||
// Buffer Filing
|
||||
if ($buf_len - $buf_pos < $startLength) {
|
||||
$buf = array_splice($buffer, $buf_pos);
|
||||
$new = $this->reloadBuffer($fp, 100);
|
||||
if ($new) {
|
||||
$buffer = array_merge($buf, $new);
|
||||
$buf_len = count($buffer);
|
||||
$buf_len = \count($buffer);
|
||||
$buf_pos = 0;
|
||||
} else {
|
||||
$has_datas = false;
|
||||
@@ -226,7 +224,7 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
|
||||
if ($new) {
|
||||
$buffer = array_merge($buffer, $new);
|
||||
$buf_len = count($buffer);
|
||||
$buf_len = \count($buffer);
|
||||
}
|
||||
}
|
||||
for ($i = 0; $i < $need && isset($buffer[$buf_pos]); ++$i) {
|
||||
@@ -262,15 +260,15 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
public function flushContents()
|
||||
{
|
||||
$this->offset = 0;
|
||||
$this->array = array();
|
||||
$this->array = [];
|
||||
$this->array_size = 0;
|
||||
}
|
||||
|
||||
private function reloadBuffer($fp, $len)
|
||||
{
|
||||
if (!feof($fp) && ($bytes = fread($fp, $len)) !== false) {
|
||||
$buf = array();
|
||||
for ($i = 0, $len = strlen($bytes); $i < $len; ++$i) {
|
||||
if (!feof($fp) && false !== ($bytes = fread($fp, $len))) {
|
||||
$buf = [];
|
||||
for ($i = 0, $len = \strlen($bytes); $i < $len; ++$i) {
|
||||
$buf[] = self::$byteMap[$bytes[$i]];
|
||||
}
|
||||
|
||||
@@ -283,9 +281,9 @@ class Swift_CharacterStream_ArrayCharacterStream implements Swift_CharacterStrea
|
||||
private static function initializeMaps()
|
||||
{
|
||||
if (!isset(self::$charMap)) {
|
||||
self::$charMap = array();
|
||||
self::$charMap = [];
|
||||
for ($byte = 0; $byte < 256; ++$byte) {
|
||||
self::$charMap[$byte] = chr($byte);
|
||||
self::$charMap[$byte] = \chr($byte);
|
||||
}
|
||||
self::$byteMap = array_flip(self::$charMap);
|
||||
}
|
||||
|
||||
@@ -81,8 +81,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Swift_CharacterReaderFactory $factory
|
||||
* @param string $charset
|
||||
* @param string $charset
|
||||
*/
|
||||
public function __construct(Swift_CharacterReaderFactory $factory, $charset)
|
||||
{
|
||||
@@ -106,8 +105,6 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
|
||||
|
||||
/**
|
||||
* Set the CharacterReaderFactory for multi charset support.
|
||||
*
|
||||
* @param Swift_CharacterReaderFactory $factory
|
||||
*/
|
||||
public function setCharacterReaderFactory(Swift_CharacterReaderFactory $factory)
|
||||
{
|
||||
@@ -128,8 +125,6 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
|
||||
|
||||
/**
|
||||
* @see Swift_CharacterStream::importByteStream()
|
||||
*
|
||||
* @param Swift_OutputByteStream $os
|
||||
*/
|
||||
public function importByteStream(Swift_OutputByteStream $os)
|
||||
{
|
||||
@@ -220,7 +215,7 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
|
||||
public function readBytes($length)
|
||||
{
|
||||
$read = $this->read($length);
|
||||
if ($read !== false) {
|
||||
if (false !== $read) {
|
||||
$ret = array_map('ord', str_split($read, 1));
|
||||
|
||||
return $ret;
|
||||
@@ -252,16 +247,16 @@ class Swift_CharacterStream_NgCharacterStream implements Swift_CharacterStream
|
||||
if (!isset($this->charReader)) {
|
||||
$this->charReader = $this->charReaderFactory->getReaderFor(
|
||||
$this->charset);
|
||||
$this->map = array();
|
||||
$this->map = [];
|
||||
$this->mapType = $this->charReader->getMapType();
|
||||
}
|
||||
$ignored = '';
|
||||
$this->datas .= $chars;
|
||||
$this->charCount += $this->charReader->getCharPositions(substr($this->datas, $this->datasSize), $this->datasSize, $this->map, $ignored);
|
||||
if ($ignored !== false) {
|
||||
$this->datasSize = strlen($this->datas) - strlen($ignored);
|
||||
if (false !== $ignored) {
|
||||
$this->datasSize = \strlen($this->datas) - \strlen($ignored);
|
||||
} else {
|
||||
$this->datasSize = strlen($this->datas);
|
||||
$this->datasSize = \strlen($this->datas);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user