mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-06 16:07:03 +03:00
More params and returns to PHP 7.3+
This commit is contained in:
parent
3d246ae842
commit
26c38b3ec9
95 changed files with 1028 additions and 4865 deletions
|
|
@ -68,13 +68,7 @@ class Binary
|
|||
*/
|
||||
private $sReadEndBuffer;
|
||||
|
||||
/**
|
||||
* @param string $sContentTransferEncoding
|
||||
* @param bool $bDecode = true
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function GetInlineDecodeOrEncodeFunctionName($sContentTransferEncoding, $bDecode = true)
|
||||
public static function GetInlineDecodeOrEncodeFunctionName(string $sContentTransferEncoding, bool $bDecode = true) : string
|
||||
{
|
||||
$sFunctionName = '';
|
||||
switch (strtolower($sContentTransferEncoding))
|
||||
|
|
@ -92,25 +86,13 @@ class Binary
|
|||
return $sFunctionName;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBodyString
|
||||
* @param string $sEndBuffer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function InlineNullDecode($sBodyString, &$sEndBuffer)
|
||||
public static function InlineNullDecode(string $sBodyString, string &$sEndBuffer) : string
|
||||
{
|
||||
$sEndBuffer = '';
|
||||
return $sBodyString;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBaseString
|
||||
* @param string $sEndBuffer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function InlineBase64Decode($sBaseString, &$sEndBuffer)
|
||||
public static function InlineBase64Decode(string $sBaseString, string &$sEndBuffer) : string
|
||||
{
|
||||
$sEndBuffer = '';
|
||||
$sBaseString = str_replace(array("\r", "\n", "\t"), '', $sBaseString);
|
||||
|
|
@ -124,13 +106,7 @@ class Binary
|
|||
return \MailSo\Base\Utils::Base64Decode($sBaseString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sQuotedPrintableString
|
||||
* @param string $sEndBuffer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function InlineQuotedPrintableDecode($sQuotedPrintableString, &$sEndBuffer)
|
||||
public static function InlineQuotedPrintableDecode(string $sQuotedPrintableString, string &$sEndBuffer) : string
|
||||
{
|
||||
$sEndBuffer = '';
|
||||
$sQuotedPrintableLen = strlen($sQuotedPrintableString);
|
||||
|
|
@ -143,13 +119,7 @@ class Binary
|
|||
return quoted_printable_decode($sQuotedPrintableString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sEncodedString
|
||||
* @param string $sEndBuffer
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function InlineConvertDecode($sEncodedString, &$sEndBuffer, $sFromEncoding, $sToEncoding)
|
||||
public static function InlineConvertDecode(string $sEncodedString, string &$sEndBuffer, string $sFromEncoding, string $sToEncoding) : string
|
||||
{
|
||||
$sEndBuffer = '';
|
||||
$sQuotedPrintableLen = strlen($sEncodedString);
|
||||
|
|
@ -164,10 +134,8 @@ class Binary
|
|||
|
||||
/**
|
||||
* @param resource $rStream
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function IsStreamRemembed($rStream)
|
||||
public static function IsStreamRemembed($rStream) : bool
|
||||
{
|
||||
foreach (self::$aRememberStreams as $rRem)
|
||||
{
|
||||
|
|
@ -193,14 +161,11 @@ class Binary
|
|||
|
||||
/**
|
||||
* @param resource $rStream
|
||||
* @param string $sUtilsDecodeOrEncodeFunctionName = null
|
||||
* @param string $sFromEncoding = null
|
||||
* @param string $sToEncoding = null
|
||||
*
|
||||
* @return resource|bool
|
||||
*/
|
||||
public static function CreateStream($rStream,
|
||||
$sUtilsDecodeOrEncodeFunctionName = null, $sFromEncoding = null, $sToEncoding = null)
|
||||
string $sUtilsDecodeOrEncodeFunctionName = null, string $sFromEncoding = null, string $sToEncoding = null)
|
||||
{
|
||||
if (!in_array(self::STREAM_NAME, stream_get_wrappers()))
|
||||
{
|
||||
|
|
@ -242,12 +207,7 @@ class Binary
|
|||
return \fopen(self::STREAM_NAME.'://'.$sHashName, 'rb');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPath
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_open($sPath)
|
||||
public function stream_open(string $sPath) : bool
|
||||
{
|
||||
$this->iPos = 0;
|
||||
$this->sBuffer = '';
|
||||
|
|
@ -281,12 +241,7 @@ class Binary
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iCount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stream_read($iCount)
|
||||
public function stream_read(int $iCount) : string
|
||||
{
|
||||
$sReturn = '';
|
||||
$sFunctionName = $this->sFunctionName;
|
||||
|
|
@ -354,35 +309,22 @@ class Binary
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_write()
|
||||
public function stream_write() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_tell()
|
||||
public function stream_tell() : int
|
||||
{
|
||||
return $this->iPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_eof()
|
||||
public function stream_eof() : bool
|
||||
{
|
||||
return 0 === strlen($this->sBuffer) && feof($this->rStream);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function stream_stat()
|
||||
public function stream_stat() : array
|
||||
{
|
||||
return array(
|
||||
'dev' => 2,
|
||||
|
|
@ -401,10 +343,7 @@ class Binary
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_seek()
|
||||
public function stream_seek() : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,11 +45,10 @@ class Literal
|
|||
|
||||
/**
|
||||
* @param resource $rStream
|
||||
* @param int $iLiteralLen
|
||||
*
|
||||
* @return resource|bool
|
||||
*/
|
||||
public static function CreateStream($rStream, $iLiteralLen)
|
||||
public static function CreateStream($rStream, int $iLiteralLen)
|
||||
{
|
||||
if (!in_array(self::STREAM_NAME, stream_get_wrappers()))
|
||||
{
|
||||
|
|
@ -65,12 +64,7 @@ class Literal
|
|||
return fopen(self::STREAM_NAME.'://'.$sHashName, 'rb');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPath
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_open($sPath)
|
||||
public function stream_open(string $sPath) : bool
|
||||
{
|
||||
$this->iPos = 0;
|
||||
$this->iSize = 0;
|
||||
|
|
@ -98,12 +92,7 @@ class Literal
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iCount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stream_read($iCount)
|
||||
public function stream_read(int $iCount) : string
|
||||
{
|
||||
$sResult = false;
|
||||
if ($this->iSize < $this->iPos + $iCount)
|
||||
|
|
@ -138,34 +127,22 @@ class Literal
|
|||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_write()
|
||||
public function stream_write() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_tell()
|
||||
public function stream_tell() : int
|
||||
{
|
||||
return $this->iPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_eof()
|
||||
public function stream_eof() : bool
|
||||
{
|
||||
return $this->iPos >= $this->iSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function stream_stat()
|
||||
public function stream_stat() : array
|
||||
{
|
||||
return array(
|
||||
'dev' => 2,
|
||||
|
|
@ -184,10 +161,7 @@ class Literal
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_seek()
|
||||
public function stream_seek() : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -54,11 +54,9 @@ class SubStreams
|
|||
private $iPos;
|
||||
|
||||
/**
|
||||
* @param array $aSubStreams
|
||||
*
|
||||
* @return resource|bool
|
||||
*/
|
||||
public static function CreateStream($aSubStreams)
|
||||
public static function CreateStream(array $aSubStreams)
|
||||
{
|
||||
if (!\in_array(self::STREAM_NAME, \stream_get_wrappers()))
|
||||
{
|
||||
|
|
@ -91,12 +89,7 @@ class SubStreams
|
|||
return $nNull;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPath
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_open($sPath)
|
||||
public function stream_open(string $sPath) : bool
|
||||
{
|
||||
$this->aSubStreams = array();
|
||||
|
||||
|
|
@ -125,12 +118,7 @@ class SubStreams
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iCount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stream_read($iCount)
|
||||
public function stream_read(int $iCount) : string
|
||||
{
|
||||
$sReturn = '';
|
||||
$mCurrentPart = null;
|
||||
|
|
@ -194,34 +182,22 @@ class SubStreams
|
|||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_write()
|
||||
public function stream_write() : int
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_tell()
|
||||
public function stream_tell() : int
|
||||
{
|
||||
return $this->iPos;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_eof()
|
||||
public function stream_eof() : bool
|
||||
{
|
||||
return $this->bIsEnd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function stream_stat()
|
||||
public function stream_stat() : array
|
||||
{
|
||||
return array(
|
||||
'dev' => 2,
|
||||
|
|
@ -240,10 +216,7 @@ class SubStreams
|
|||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_seek()
|
||||
public function stream_seek() : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,12 +42,9 @@ class TempFile
|
|||
}
|
||||
|
||||
/**
|
||||
* @param string $sHash
|
||||
* @param string $sFileName
|
||||
*
|
||||
* @return resource|bool
|
||||
*/
|
||||
public static function CreateStream($sHash, &$sFileName = '')
|
||||
public static function CreateStream(string $sHash, string &$sFileName = '')
|
||||
{
|
||||
self::Reg();
|
||||
|
||||
|
|
@ -55,12 +52,7 @@ class TempFile
|
|||
return fopen($sFileName, 'r+b');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPath
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_open($sPath)
|
||||
public function stream_open(string $sPath) : bool
|
||||
{
|
||||
$bResult = false;
|
||||
$aPath = parse_url($sPath);
|
||||
|
|
@ -91,73 +83,42 @@ class TempFile
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_close()
|
||||
public function stream_close() : bool
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_flush()
|
||||
public function stream_flush() : bool
|
||||
{
|
||||
return fflush($this->rSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iLen
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stream_read($iLen)
|
||||
public function stream_read(int $iLen) : string
|
||||
{
|
||||
return fread($this->rSream, $iLen);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sInputString
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function stream_write($sInputString)
|
||||
public function stream_write(string $sInputString) : int
|
||||
{
|
||||
return fwrite($this->rSream, $sInputString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_tell()
|
||||
public function stream_tell() : int
|
||||
{
|
||||
return ftell($this->rSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_eof()
|
||||
public function stream_eof() : bool
|
||||
{
|
||||
return feof($this->rSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function stream_stat()
|
||||
public function stream_stat() : array
|
||||
{
|
||||
return fstat($this->rSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iOffset
|
||||
* @param int $iWhence = SEEK_SET
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function stream_seek($iOffset, $iWhence = SEEK_SET)
|
||||
public function stream_seek(int $iOffset, int $iWhence = SEEK_SET) : int
|
||||
{
|
||||
return fseek($this->rSream, $iOffset, $iWhence);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,11 +34,10 @@ class Test
|
|||
private $rReadSream;
|
||||
|
||||
/**
|
||||
* @param string $sRawResponse
|
||||
*
|
||||
* @return resource|bool
|
||||
*/
|
||||
public static function CreateStream($sRawResponse)
|
||||
public static function CreateStream(string $sRawResponse)
|
||||
{
|
||||
if (!in_array(self::STREAM_NAME, stream_get_wrappers()))
|
||||
{
|
||||
|
|
@ -58,12 +57,7 @@ class Test
|
|||
return fopen(self::STREAM_NAME.'://'.$sHashName, 'r+b');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sPath
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_open($sPath)
|
||||
public function stream_open(string $sPath) : bool
|
||||
{
|
||||
$bResult = false;
|
||||
$aPath = parse_url($sPath);
|
||||
|
|
@ -84,54 +78,32 @@ class Test
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iCount
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function stream_read($iCount)
|
||||
public function stream_read(int $iCount) : string
|
||||
{
|
||||
return fread($this->rReadSream, $iCount);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sInputString
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function stream_write($sInputString)
|
||||
public function stream_write(string $sInputString) : int
|
||||
{
|
||||
return strlen($sInputString);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function stream_tell()
|
||||
public function stream_tell() : int
|
||||
{
|
||||
return ftell($this->rReadSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_eof()
|
||||
public function stream_eof() : bool
|
||||
{
|
||||
return feof($this->rReadSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function stream_stat()
|
||||
public function stream_stat() : array
|
||||
{
|
||||
return fstat($this->rReadSream);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function stream_seek()
|
||||
public function stream_seek() : bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue