mirror of
https://github.com/itflow-org/itflow
synced 2026-03-14 01:34:51 +00:00
Add new optional beta email parser thats based on ImapEngine instead of Webklex
This commit is contained in:
47
plugins/vendor/zbateson/mail-mime-parser/src/Header/GenericHeader.php
vendored
Normal file
47
plugins/vendor/zbateson/mail-mime-parser/src/Header/GenericHeader.php
vendored
Normal file
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
/**
|
||||
* This file is part of the ZBateson\MailMimeParser project.
|
||||
*
|
||||
* @license http://opensource.org/licenses/bsd-license.php BSD
|
||||
*/
|
||||
|
||||
namespace ZBateson\MailMimeParser\Header;
|
||||
|
||||
use Psr\Log\LoggerInterface;
|
||||
use ZBateson\MailMimeParser\Header\Consumer\GenericConsumerMimeLiteralPartService;
|
||||
use ZBateson\MailMimeParser\MailMimeParser;
|
||||
|
||||
/**
|
||||
* Reads a generic header.
|
||||
*
|
||||
* Header's may contain mime-encoded parts, quoted parts, and comments. The
|
||||
* string value is the combined value of all its parts.
|
||||
*
|
||||
* @author Zaahid Bateson
|
||||
*/
|
||||
class GenericHeader extends AbstractHeader
|
||||
{
|
||||
public function __construct(
|
||||
string $name,
|
||||
string $value,
|
||||
?LoggerInterface $logger = null,
|
||||
?GenericConsumerMimeLiteralPartService $consumerService = null
|
||||
) {
|
||||
$di = MailMimeParser::getGlobalContainer();
|
||||
parent::__construct(
|
||||
$logger ?? $di->get(LoggerInterface::class),
|
||||
$consumerService ?? $di->get(DateConsumerService::class),
|
||||
$name,
|
||||
$value
|
||||
);
|
||||
parent::__construct($logger, $consumerService, $name, $value);
|
||||
}
|
||||
|
||||
public function getValue() : ?string
|
||||
{
|
||||
if (!empty($this->parts)) {
|
||||
return \implode('', \array_map(function($p) { return $p->getValue(); }, $this->parts));
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user