mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-07 16:37:02 +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
|
|
@ -69,27 +69,18 @@ class Part
|
|||
*/
|
||||
private $iParseBuffer;
|
||||
|
||||
/**
|
||||
* @access private
|
||||
*/
|
||||
private function __construct()
|
||||
{
|
||||
$this->iParseBuffer = \MailSo\Mime\Part::DEFAUL_BUFFER;
|
||||
$this->Reset();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public static function NewInstance()
|
||||
public static function NewInstance() : self
|
||||
{
|
||||
return new self();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function Reset()
|
||||
public function Reset() : self
|
||||
{
|
||||
\MailSo\Base\ResourceRegistry::CloseMemoryResource($this->Body);
|
||||
$this->Body = null;
|
||||
|
|
@ -103,117 +94,78 @@ class Part
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function Boundary()
|
||||
public function Boundary() : string
|
||||
{
|
||||
return $this->sBoundary;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ParentCharset()
|
||||
public function ParentCharset() : string
|
||||
{
|
||||
return (0 < \strlen($this->sCharset)) ? $this->sParentCharset : self::$DefaultCharset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sParentCharset
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function SetParentCharset($sParentCharset)
|
||||
public function SetParentCharset(string $sParentCharset) : self
|
||||
{
|
||||
$this->sParentCharset = $sParentCharset;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sBoundary
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function SetBoundary($sBoundary)
|
||||
public function SetBoundary(string $sBoundary) : self
|
||||
{
|
||||
$this->sBoundary = $sBoundary;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $iParseBuffer
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function SetParseBuffer($iParseBuffer)
|
||||
public function SetParseBuffer(int $iParseBuffer) : self
|
||||
{
|
||||
$this->iParseBuffer = $iParseBuffer;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function HeaderCharset()
|
||||
public function HeaderCharset() : string
|
||||
{
|
||||
return ($this->Headers) ? trim(strtolower($this->Headers->ParameterValue(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE,
|
||||
\MailSo\Mime\Enumerations\Parameter::CHARSET))) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function HeaderBoundary()
|
||||
public function HeaderBoundary() : string
|
||||
{
|
||||
return ($this->Headers) ? trim($this->Headers->ParameterValue(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE,
|
||||
\MailSo\Mime\Enumerations\Parameter::BOUNDARY)) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ContentType()
|
||||
public function ContentType() : string
|
||||
{
|
||||
return ($this->Headers) ?
|
||||
trim(strtolower($this->Headers->ValueByName(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE))) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ContentTransferEncoding()
|
||||
public function ContentTransferEncoding() : string
|
||||
{
|
||||
return ($this->Headers) ?
|
||||
trim(strtolower($this->Headers->ValueByName(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_TRANSFER_ENCODING))) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ContentID()
|
||||
public function ContentID() : string
|
||||
{
|
||||
return ($this->Headers) ? trim($this->Headers->ValueByName(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_ID)) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function ContentLocation()
|
||||
public function ContentLocation() : string
|
||||
{
|
||||
return ($this->Headers) ? trim($this->Headers->ValueByName(
|
||||
\MailSo\Mime\Enumerations\Header::CONTENT_LOCATION)) : '';
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function IsFlowedFormat()
|
||||
public function IsFlowedFormat() : bool
|
||||
{
|
||||
$bResult = false;
|
||||
if ($this->Headers)
|
||||
|
|
@ -231,10 +183,7 @@ class Part
|
|||
return $bResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function FileName()
|
||||
public function FileName() : string
|
||||
{
|
||||
$sResult = '';
|
||||
if ($this->Headers)
|
||||
|
|
@ -254,11 +203,7 @@ class Part
|
|||
return $sResult;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sFileName
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function ParseFromFile($sFileName)
|
||||
public function ParseFromFile(string $sFileName) : self
|
||||
{
|
||||
$rStreamHandle = (@file_exists($sFileName)) ? @fopen($sFileName, 'rb') : false;
|
||||
if (is_resource($rStreamHandle))
|
||||
|
|
@ -274,11 +219,7 @@ class Part
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sRawMessage
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function ParseFromString($sRawMessage)
|
||||
public function ParseFromString(string $sRawMessage) : self
|
||||
{
|
||||
$rStreamHandle = (0 < strlen($sRawMessage)) ?
|
||||
\MailSo\Base\ResourceRegistry::CreateMemoryResource() : false;
|
||||
|
|
@ -299,9 +240,8 @@ class Part
|
|||
|
||||
/**
|
||||
* @param resource $rStreamHandle
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function ParseFromStream($rStreamHandle)
|
||||
public function ParseFromStream($rStreamHandle) : self
|
||||
{
|
||||
$this->Reset();
|
||||
|
||||
|
|
@ -361,10 +301,9 @@ class Part
|
|||
|
||||
/**
|
||||
* @param resource $rStreamHandle
|
||||
* @return \MailSo\Mime\Part
|
||||
*/
|
||||
public function ParseFromStreamRecursion($rStreamHandle, &$oCallbackClass, &$iOffset,
|
||||
&$sPrevBuffer, &$sBuffer, &$aBoundaryStack, &$bIsOef, $bNotFirstRead = false)
|
||||
public function ParseFromStreamRecursion($rStreamHandle, &$oCallbackClass, int &$iOffset,
|
||||
string &$sPrevBuffer, string &$sBuffer, array &$aBoundaryStack, bool &$bIsOef, bool $bNotFirstRead = false) : self
|
||||
{
|
||||
$oCallbackClass->StartParseMimePart($this);
|
||||
|
||||
|
|
@ -610,7 +549,7 @@ class Part
|
|||
}
|
||||
|
||||
/**
|
||||
* @return resorce
|
||||
* @return resource
|
||||
*/
|
||||
public function Rewind()
|
||||
{
|
||||
|
|
@ -625,7 +564,7 @@ class Part
|
|||
}
|
||||
|
||||
/**
|
||||
* @return resorce
|
||||
* @return resource
|
||||
*/
|
||||
public function ToStream()
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue