package and depencies
This commit is contained in:
18
vendor/symfony/mime/Header/AbstractHeader.php
vendored
18
vendor/symfony/mime/Header/AbstractHeader.php
vendored
@@ -22,12 +22,12 @@ abstract class AbstractHeader implements HeaderInterface
|
||||
{
|
||||
public const PHRASE_PATTERN = '(?:(?:(?:(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(?:\r\n))?[ \t])))?[a-zA-Z0-9!#\$%&\'\*\+\-\/=\?\^_`\{\}\|~]+(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))*(?:(?:(?:(?:[ \t]*(?:\r\n))?[ \t])?(\((?:(?:(?:[ \t]*(?:\r\n))?[ \t])|(?:(?:[\x01-\x08\x0B\x0C\x0E-\x19\x7F]|[\x21-\x27\x2A-\x5B\x5D-\x7E])|(?:\\[\x00-\x08\x0B\x0C\x0E-\x7F])|(?1)))*(?:(?:[ \t]*(?:\r\n))?[ \t])?\)))|(?:(?:[ \t]*(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||||
|
||||
private static $encoder;
|
||||
private static QpMimeHeaderEncoder $encoder;
|
||||
|
||||
private $name;
|
||||
private $lineLength = 76;
|
||||
private $lang;
|
||||
private $charset = 'utf-8';
|
||||
private string $name;
|
||||
private int $lineLength = 76;
|
||||
private ?string $lang = null;
|
||||
private string $charset = 'utf-8';
|
||||
|
||||
public function __construct(string $name)
|
||||
{
|
||||
@@ -188,9 +188,7 @@ abstract class AbstractHeader implements HeaderInterface
|
||||
*/
|
||||
protected function getTokenAsEncodedWord(string $token, int $firstLineOffset = 0): string
|
||||
{
|
||||
if (null === self::$encoder) {
|
||||
self::$encoder = new QpMimeHeaderEncoder();
|
||||
}
|
||||
self::$encoder ??= new QpMimeHeaderEncoder();
|
||||
|
||||
// Adjust $firstLineOffset to account for space needed for syntax
|
||||
$charsetDecl = $this->charset;
|
||||
@@ -233,9 +231,7 @@ abstract class AbstractHeader implements HeaderInterface
|
||||
*/
|
||||
protected function toTokens(string $string = null): array
|
||||
{
|
||||
if (null === $string) {
|
||||
$string = $this->getBodyAsString();
|
||||
}
|
||||
$string ??= $this->getBodyAsString();
|
||||
|
||||
$tokens = [];
|
||||
// Generate atoms; split at all invisible boundaries followed by WSP
|
||||
|
4
vendor/symfony/mime/Header/DateHeader.php
vendored
4
vendor/symfony/mime/Header/DateHeader.php
vendored
@@ -18,7 +18,7 @@ namespace Symfony\Component\Mime\Header;
|
||||
*/
|
||||
final class DateHeader extends AbstractHeader
|
||||
{
|
||||
private $dateTime;
|
||||
private \DateTimeImmutable $dateTime;
|
||||
|
||||
public function __construct(string $name, \DateTimeInterface $date)
|
||||
{
|
||||
@@ -30,7 +30,7 @@ final class DateHeader extends AbstractHeader
|
||||
/**
|
||||
* @param \DateTimeInterface $body
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function setBody(mixed $body)
|
||||
{
|
||||
$this->setDateTime($body);
|
||||
}
|
||||
|
@@ -22,19 +22,15 @@ interface HeaderInterface
|
||||
* Sets the body.
|
||||
*
|
||||
* The type depends on the Header concrete class.
|
||||
*
|
||||
* @param mixed $body
|
||||
*/
|
||||
public function setBody($body);
|
||||
public function setBody(mixed $body);
|
||||
|
||||
/**
|
||||
* Gets the body.
|
||||
*
|
||||
* The return type depends on the Header concrete class.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getBody();
|
||||
public function getBody(): mixed;
|
||||
|
||||
public function setCharset(string $charset);
|
||||
|
||||
|
61
vendor/symfony/mime/Header/Headers.php
vendored
61
vendor/symfony/mime/Header/Headers.php
vendored
@@ -34,16 +34,16 @@ final class Headers
|
||||
'cc' => MailboxListHeader::class,
|
||||
'bcc' => MailboxListHeader::class,
|
||||
'message-id' => IdentificationHeader::class,
|
||||
'in-reply-to' => UnstructuredHeader::class, // `In-Reply-To` and `References` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ...
|
||||
'references' => UnstructuredHeader::class, // ... `Message-ID`, even if that is no valid `msg-id`
|
||||
'in-reply-to' => [UnstructuredHeader::class, IdentificationHeader::class], // `In-Reply-To` and `References` are less strict than RFC 2822 (3.6.4) to allow users entering the original email's ...
|
||||
'references' => [UnstructuredHeader::class, IdentificationHeader::class], // ... `Message-ID`, even if that is no valid `msg-id`
|
||||
'return-path' => PathHeader::class,
|
||||
];
|
||||
|
||||
/**
|
||||
* @var HeaderInterface[][]
|
||||
*/
|
||||
private $headers = [];
|
||||
private $lineLength = 76;
|
||||
private array $headers = [];
|
||||
private int $lineLength = 76;
|
||||
|
||||
public function __construct(HeaderInterface ...$headers)
|
||||
{
|
||||
@@ -79,37 +79,31 @@ final class Headers
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addMailboxListHeader(string $name, array $addresses): self
|
||||
public function addMailboxListHeader(string $name, array $addresses): static
|
||||
{
|
||||
return $this->add(new MailboxListHeader($name, Address::createArray($addresses)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address|string $address
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addMailboxHeader(string $name, $address): self
|
||||
public function addMailboxHeader(string $name, Address|string $address): static
|
||||
{
|
||||
return $this->add(new MailboxHeader($name, Address::create($address)));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $ids
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addIdHeader(string $name, $ids): self
|
||||
public function addIdHeader(string $name, string|array $ids): static
|
||||
{
|
||||
return $this->add(new IdentificationHeader($name, $ids));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Address|string $path
|
||||
*
|
||||
* @return $this
|
||||
*/
|
||||
public function addPathHeader(string $name, $path): self
|
||||
public function addPathHeader(string $name, Address|string $path): static
|
||||
{
|
||||
return $this->add(new PathHeader($name, $path instanceof Address ? $path : new Address($path)));
|
||||
}
|
||||
@@ -117,7 +111,7 @@ final class Headers
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addDateHeader(string $name, \DateTimeInterface $dateTime): self
|
||||
public function addDateHeader(string $name, \DateTimeInterface $dateTime): static
|
||||
{
|
||||
return $this->add(new DateHeader($name, $dateTime));
|
||||
}
|
||||
@@ -125,7 +119,7 @@ final class Headers
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addTextHeader(string $name, string $value): self
|
||||
public function addTextHeader(string $name, string $value): static
|
||||
{
|
||||
return $this->add(new UnstructuredHeader($name, $value));
|
||||
}
|
||||
@@ -133,7 +127,7 @@ final class Headers
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addParameterizedHeader(string $name, string $value, array $params = []): self
|
||||
public function addParameterizedHeader(string $name, string $value, array $params = []): static
|
||||
{
|
||||
return $this->add(new ParameterizedHeader($name, $value, $params));
|
||||
}
|
||||
@@ -141,9 +135,13 @@ final class Headers
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function addHeader(string $name, $argument, array $more = []): self
|
||||
public function addHeader(string $name, mixed $argument, array $more = []): static
|
||||
{
|
||||
$parts = explode('\\', self::HEADER_CLASS_MAP[strtolower($name)] ?? UnstructuredHeader::class);
|
||||
$headerClass = self::HEADER_CLASS_MAP[strtolower($name)] ?? UnstructuredHeader::class;
|
||||
if (\is_array($headerClass)) {
|
||||
$headerClass = $headerClass[0];
|
||||
}
|
||||
$parts = explode('\\', $headerClass);
|
||||
$method = 'add'.ucfirst(array_pop($parts));
|
||||
if ('addUnstructuredHeader' === $method) {
|
||||
$method = 'addTextHeader';
|
||||
@@ -162,7 +160,7 @@ final class Headers
|
||||
/**
|
||||
* @return $this
|
||||
*/
|
||||
public function add(HeaderInterface $header): self
|
||||
public function add(HeaderInterface $header): static
|
||||
{
|
||||
self::checkHeaderClass($header);
|
||||
|
||||
@@ -226,10 +224,22 @@ final class Headers
|
||||
public static function checkHeaderClass(HeaderInterface $header): void
|
||||
{
|
||||
$name = strtolower($header->getName());
|
||||
|
||||
if (($c = self::HEADER_CLASS_MAP[$name] ?? null) && !$header instanceof $c) {
|
||||
throw new LogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), $c, get_debug_type($header)));
|
||||
$headerClasses = self::HEADER_CLASS_MAP[$name] ?? [];
|
||||
if (!\is_array($headerClasses)) {
|
||||
$headerClasses = [$headerClasses];
|
||||
}
|
||||
|
||||
if (!$headerClasses) {
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($headerClasses as $c) {
|
||||
if ($header instanceof $c) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
throw new LogicException(sprintf('The "%s" header must be an instance of "%s" (got "%s").', $header->getName(), implode('" or "', $headerClasses), get_debug_type($header)));
|
||||
}
|
||||
|
||||
public function toString(): string
|
||||
@@ -254,9 +264,6 @@ final class Headers
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function getHeaderBody(string $name)
|
||||
{
|
||||
return $this->has($name) ? $this->get($name)->getBody() : null;
|
||||
@@ -265,7 +272,7 @@ final class Headers
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
public function setHeaderBody(string $type, string $name, $body): void
|
||||
public function setHeaderBody(string $type, string $name, mixed $body): void
|
||||
{
|
||||
if ($this->has($name)) {
|
||||
$this->get($name)->setBody($body);
|
||||
|
@@ -21,13 +21,10 @@ use Symfony\Component\Mime\Exception\RfcComplianceException;
|
||||
*/
|
||||
final class IdentificationHeader extends AbstractHeader
|
||||
{
|
||||
private $ids = [];
|
||||
private $idsAsAddresses = [];
|
||||
private array $ids = [];
|
||||
private array $idsAsAddresses = [];
|
||||
|
||||
/**
|
||||
* @param string|array $ids
|
||||
*/
|
||||
public function __construct(string $name, $ids)
|
||||
public function __construct(string $name, string|array $ids)
|
||||
{
|
||||
parent::__construct($name);
|
||||
|
||||
@@ -35,11 +32,11 @@ final class IdentificationHeader extends AbstractHeader
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string|array $body a string ID or an array of IDs
|
||||
* @param string|string[] $body a string ID or an array of IDs
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function setBody(mixed $body)
|
||||
{
|
||||
$this->setId($body);
|
||||
}
|
||||
@@ -52,11 +49,11 @@ final class IdentificationHeader extends AbstractHeader
|
||||
/**
|
||||
* Set the ID used in the value of this header.
|
||||
*
|
||||
* @param string|array $id
|
||||
* @param string|string[] $id
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function setId($id)
|
||||
public function setId(string|array $id)
|
||||
{
|
||||
$this->setIds(\is_array($id) ? $id : [$id]);
|
||||
}
|
||||
|
4
vendor/symfony/mime/Header/MailboxHeader.php
vendored
4
vendor/symfony/mime/Header/MailboxHeader.php
vendored
@@ -21,7 +21,7 @@ use Symfony\Component\Mime\Exception\RfcComplianceException;
|
||||
*/
|
||||
final class MailboxHeader extends AbstractHeader
|
||||
{
|
||||
private $address;
|
||||
private Address $address;
|
||||
|
||||
public function __construct(string $name, Address $address)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ final class MailboxHeader extends AbstractHeader
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function setBody(mixed $body)
|
||||
{
|
||||
$this->setAddress($body);
|
||||
}
|
||||
|
12
vendor/symfony/mime/Header/MailboxListHeader.php
vendored
12
vendor/symfony/mime/Header/MailboxListHeader.php
vendored
@@ -21,7 +21,7 @@ use Symfony\Component\Mime\Exception\RfcComplianceException;
|
||||
*/
|
||||
final class MailboxListHeader extends AbstractHeader
|
||||
{
|
||||
private $addresses = [];
|
||||
private array $addresses = [];
|
||||
|
||||
/**
|
||||
* @param Address[] $addresses
|
||||
@@ -38,15 +38,15 @@ final class MailboxListHeader extends AbstractHeader
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function setBody(mixed $body)
|
||||
{
|
||||
$this->setAddresses($body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RfcComplianceException
|
||||
*
|
||||
* @return Address[]
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function getBody(): array
|
||||
{
|
||||
@@ -99,9 +99,9 @@ final class MailboxListHeader extends AbstractHeader
|
||||
/**
|
||||
* Gets the full mailbox list of this Header as an array of valid RFC 2822 strings.
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*
|
||||
* @return string[]
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function getAddressStrings(): array
|
||||
{
|
||||
|
@@ -25,8 +25,8 @@ final class ParameterizedHeader extends UnstructuredHeader
|
||||
*/
|
||||
public const TOKEN_REGEX = '(?:[\x21\x23-\x27\x2A\x2B\x2D\x2E\x30-\x39\x41-\x5A\x5E-\x7E]+)';
|
||||
|
||||
private $encoder;
|
||||
private $parameters = [];
|
||||
private ?Rfc2231Encoder $encoder = null;
|
||||
private array $parameters = [];
|
||||
|
||||
public function __construct(string $name, string $value, array $parameters = [])
|
||||
{
|
||||
|
4
vendor/symfony/mime/Header/PathHeader.php
vendored
4
vendor/symfony/mime/Header/PathHeader.php
vendored
@@ -21,7 +21,7 @@ use Symfony\Component\Mime\Exception\RfcComplianceException;
|
||||
*/
|
||||
final class PathHeader extends AbstractHeader
|
||||
{
|
||||
private $address;
|
||||
private Address $address;
|
||||
|
||||
public function __construct(string $name, Address $address)
|
||||
{
|
||||
@@ -35,7 +35,7 @@ final class PathHeader extends AbstractHeader
|
||||
*
|
||||
* @throws RfcComplianceException
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function setBody(mixed $body)
|
||||
{
|
||||
$this->setAddress($body);
|
||||
}
|
||||
|
@@ -18,7 +18,7 @@ namespace Symfony\Component\Mime\Header;
|
||||
*/
|
||||
class UnstructuredHeader extends AbstractHeader
|
||||
{
|
||||
private $value;
|
||||
private string $value;
|
||||
|
||||
public function __construct(string $name, string $value)
|
||||
{
|
||||
@@ -30,15 +30,12 @@ class UnstructuredHeader extends AbstractHeader
|
||||
/**
|
||||
* @param string $body
|
||||
*/
|
||||
public function setBody($body)
|
||||
public function setBody(mixed $body)
|
||||
{
|
||||
$this->setValue($body);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getBody()
|
||||
public function getBody(): string
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
Reference in New Issue
Block a user