forked from Wavyzz/dolibarr
FIX: Update swiftmailer librairies
This commit is contained in:
@@ -20,7 +20,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $contents = array();
|
||||
private $contents = [];
|
||||
|
||||
/**
|
||||
* An InputStream for cloning.
|
||||
@@ -32,8 +32,6 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
/**
|
||||
* Create a new ArrayKeyCache with the given $stream for cloning to make
|
||||
* InputByteStreams.
|
||||
*
|
||||
* @param Swift_KeyCache_KeyCacheInputStream $stream
|
||||
*/
|
||||
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream)
|
||||
{
|
||||
@@ -64,10 +62,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
$this->contents[$nsKey][$itemKey] .= $string;
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException(
|
||||
'Invalid mode ['.$mode.'] used to set nsKey='.
|
||||
$nsKey.', itemKey='.$itemKey
|
||||
);
|
||||
throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,10 +71,9 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_OutputByteStream $os
|
||||
* @param int $mode
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param int $mode
|
||||
*/
|
||||
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
|
||||
{
|
||||
@@ -87,6 +81,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
switch ($mode) {
|
||||
case self::MODE_WRITE:
|
||||
$this->clearKey($nsKey, $itemKey);
|
||||
// no break
|
||||
case self::MODE_APPEND:
|
||||
if (!$this->hasKey($nsKey, $itemKey)) {
|
||||
$this->contents[$nsKey][$itemKey] = '';
|
||||
@@ -96,10 +91,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
}
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException(
|
||||
'Invalid mode ['.$mode.'] used to set nsKey='.
|
||||
$nsKey.', itemKey='.$itemKey
|
||||
);
|
||||
throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,9 +100,8 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* NOTE: The stream will always write in append mode.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_InputByteStream $writeThrough
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return Swift_InputByteStream
|
||||
*/
|
||||
@@ -168,7 +159,7 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
{
|
||||
$this->prepareCache($nsKey);
|
||||
|
||||
return array_key_exists($itemKey, $this->contents[$nsKey]);
|
||||
return \array_key_exists($itemKey, $this->contents[$nsKey]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -199,8 +190,8 @@ class Swift_KeyCache_ArrayKeyCache implements Swift_KeyCache
|
||||
*/
|
||||
private function prepareCache($nsKey)
|
||||
{
|
||||
if (!array_key_exists($nsKey, $this->contents)) {
|
||||
$this->contents[$nsKey] = array();
|
||||
if (!\array_key_exists($nsKey, $this->contents)) {
|
||||
$this->contents[$nsKey] = [];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,14 +43,13 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $keys = array();
|
||||
private $keys = [];
|
||||
|
||||
/**
|
||||
* Create a new DiskKeyCache with the given $stream for cloning to make
|
||||
* InputByteStreams, and the given $path to save to.
|
||||
*
|
||||
* @param Swift_KeyCache_KeyCacheInputStream $stream
|
||||
* @param string $path to save to
|
||||
* @param string $path to save to
|
||||
*/
|
||||
public function __construct(Swift_KeyCache_KeyCacheInputStream $stream, $path)
|
||||
{
|
||||
@@ -81,10 +80,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException(
|
||||
'Invalid mode ['.$mode.'] used to set nsKey='.
|
||||
$nsKey.', itemKey='.$itemKey
|
||||
);
|
||||
throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
|
||||
break;
|
||||
}
|
||||
fwrite($fp, $string);
|
||||
@@ -96,10 +92,9 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_OutputByteStream $os
|
||||
* @param int $mode
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param int $mode
|
||||
*
|
||||
* @throws Swift_IoException
|
||||
*/
|
||||
@@ -114,10 +109,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
$fp = $this->getHandle($nsKey, $itemKey, self::POSITION_END);
|
||||
break;
|
||||
default:
|
||||
throw new Swift_SwiftException(
|
||||
'Invalid mode ['.$mode.'] used to set nsKey='.
|
||||
$nsKey.', itemKey='.$itemKey
|
||||
);
|
||||
throw new Swift_SwiftException('Invalid mode ['.$mode.'] used to set nsKey='.$nsKey.', itemKey='.$itemKey);
|
||||
break;
|
||||
}
|
||||
while (false !== $bytes = $os->read(8192)) {
|
||||
@@ -131,9 +123,8 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* NOTE: The stream will always write in append mode.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_InputByteStream $writeThrough
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return Swift_InputByteStream
|
||||
*/
|
||||
@@ -227,7 +218,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
*/
|
||||
public function clearAll($nsKey)
|
||||
{
|
||||
if (array_key_exists($nsKey, $this->keys)) {
|
||||
if (\array_key_exists($nsKey, $this->keys)) {
|
||||
foreach ($this->keys[$nsKey] as $itemKey => $null) {
|
||||
$this->clearKey($nsKey, $itemKey);
|
||||
}
|
||||
@@ -250,7 +241,7 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
if (!mkdir($cacheDir)) {
|
||||
throw new Swift_IoException('Failed to create cache directory '.$cacheDir);
|
||||
}
|
||||
$this->keys[$nsKey] = array();
|
||||
$this->keys[$nsKey] = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -295,4 +286,9 @@ class Swift_KeyCache_DiskKeyCache implements Swift_KeyCache
|
||||
$this->clearAll($nsKey);
|
||||
}
|
||||
}
|
||||
|
||||
public function __wakeup()
|
||||
{
|
||||
$this->keys = [];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,8 +17,6 @@ interface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream
|
||||
{
|
||||
/**
|
||||
* Set the KeyCache to wrap.
|
||||
*
|
||||
* @param Swift_KeyCache $keyCache
|
||||
*/
|
||||
public function setKeyCache(Swift_KeyCache $keyCache);
|
||||
|
||||
@@ -38,8 +36,6 @@ interface Swift_KeyCache_KeyCacheInputStream extends Swift_InputByteStream
|
||||
|
||||
/**
|
||||
* Specify a stream to write through for each write().
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function setWriteThroughStream(Swift_InputByteStream $is);
|
||||
|
||||
|
||||
@@ -34,10 +34,9 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* @see MODE_WRITE, MODE_APPEND
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_OutputByteStream $os
|
||||
* @param int $mode
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param int $mode
|
||||
*/
|
||||
public function importFromByteStream($nsKey, $itemKey, Swift_OutputByteStream $os, $mode)
|
||||
{
|
||||
@@ -48,9 +47,8 @@ class Swift_KeyCache_NullKeyCache implements Swift_KeyCache
|
||||
*
|
||||
* NOTE: The stream will always write in append mode.
|
||||
*
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
* @param Swift_InputByteStream $writeThrough
|
||||
* @param string $nsKey
|
||||
* @param string $itemKey
|
||||
*
|
||||
* @return Swift_InputByteStream
|
||||
*/
|
||||
|
||||
@@ -29,8 +29,6 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
|
||||
|
||||
/**
|
||||
* Set the KeyCache to wrap.
|
||||
*
|
||||
* @param Swift_KeyCache $keyCache
|
||||
*/
|
||||
public function setKeyCache(Swift_KeyCache $keyCache)
|
||||
{
|
||||
@@ -39,8 +37,6 @@ class Swift_KeyCache_SimpleKeyCacheInputStream implements Swift_KeyCache_KeyCach
|
||||
|
||||
/**
|
||||
* Specify a stream to write through for each write().
|
||||
*
|
||||
* @param Swift_InputByteStream $is
|
||||
*/
|
||||
public function setWriteThroughStream(Swift_InputByteStream $is)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user