N°5809 Update laminas/laminas-mail from 2.16.0 to 2.22.0

This commit is contained in:
Pierre Goiffon
2024-01-25 17:24:43 +01:00
parent f3d3ec6ef7
commit 0f39ea8ac7
146 changed files with 4426 additions and 8899 deletions

View File

@@ -4,6 +4,9 @@ namespace Laminas\Mail\Header;
use Laminas\Mime\Mime;
use function strtolower;
use function strtoupper;
/**
* Subject header class methods.
*
@@ -12,9 +15,7 @@ use Laminas\Mime\Mime;
*/
class Subject implements UnstructuredInterface
{
/**
* @var string
*/
/** @var string */
protected $subject = '';
/**
@@ -24,10 +25,14 @@ class Subject implements UnstructuredInterface
*/
protected $encoding;
/**
* @param string $headerLine
* @return static
*/
public static function fromString($headerLine)
{
list($name, $value) = GenericHeader::splitHeaderLine($headerLine);
$value = HeaderWrap::mimeDecodeValue($value);
[$name, $value] = GenericHeader::splitHeaderLine($headerLine);
$value = HeaderWrap::mimeDecodeValue($value);
// check to ensure proper header type for this factory
if (strtolower($name) !== 'subject') {
@@ -40,11 +45,17 @@ class Subject implements UnstructuredInterface
return $header;
}
/**
* @return string
*/
public function getFieldName()
{
return 'Subject';
}
/**
* @inheritDoc
*/
public function getFieldValue($format = HeaderInterface::FORMAT_RAW)
{
if (HeaderInterface::FORMAT_ENCODED === $format) {
@@ -54,6 +65,10 @@ class Subject implements UnstructuredInterface
return $this->subject;
}
/**
* @param string $encoding
* @return self
*/
public function setEncoding($encoding)
{
if ($encoding === $this->encoding) {
@@ -81,6 +96,9 @@ class Subject implements UnstructuredInterface
return $this;
}
/**
* @return string
*/
public function getEncoding()
{
if (! $this->encoding) {
@@ -90,6 +108,10 @@ class Subject implements UnstructuredInterface
return $this->encoding;
}
/**
* @param string $subject
* @return self
*/
public function setSubject($subject)
{
$subject = (string) $subject;
@@ -106,6 +128,9 @@ class Subject implements UnstructuredInterface
return $this;
}
/**
* @return string
*/
public function toString()
{
return 'Subject: ' . $this->getFieldValue(HeaderInterface::FORMAT_ENCODED);