glastree_on_gitea

This commit is contained in:
2026-05-26 08:14:29 +02:00
commit 0bed099d05
9556 changed files with 1186307 additions and 0 deletions
@@ -0,0 +1,42 @@
<?php
/**
* This file is part of the ZBateson\MailMimeParser project.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*/
namespace ZBateson\MailMimeParser\Message\Factory;
use Psr\Log\LoggerInterface;
use ZBateson\MailMimeParser\Message\IMessagePart;
use ZBateson\MailMimeParser\Message\IMimePart;
use ZBateson\MailMimeParser\Stream\StreamFactory;
/**
* Abstract factory for subclasses of IMessagePart.
*
* @author Zaahid Bateson
*/
abstract class IMessagePartFactory
{
protected LoggerInterface $logger;
protected StreamFactory $streamFactory;
protected PartStreamContainerFactory $partStreamContainerFactory;
public function __construct(
LoggerInterface $logger,
StreamFactory $streamFactory,
PartStreamContainerFactory $partStreamContainerFactory
) {
$this->logger = $logger;
$this->streamFactory = $streamFactory;
$this->partStreamContainerFactory = $partStreamContainerFactory;
}
/**
* Constructs a new IMessagePart object and returns it
*/
abstract public function newInstance(?IMimePart $parent = null) : IMessagePart;
}
@@ -0,0 +1,55 @@
<?php
/**
* This file is part of the ZBateson\MailMimeParser project.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*/
namespace ZBateson\MailMimeParser\Message\Factory;
use Psr\Log\LoggerInterface;
use ZBateson\MailMimeParser\Message\IMimePart;
use ZBateson\MailMimeParser\Message\MimePart;
use ZBateson\MailMimeParser\Stream\StreamFactory;
/**
* Responsible for creating IMimePart instances.
*
* @author Zaahid Bateson
*/
class IMimePartFactory extends IMessagePartFactory
{
protected PartHeaderContainerFactory $partHeaderContainerFactory;
protected PartChildrenContainerFactory $partChildrenContainerFactory;
public function __construct(
LoggerInterface $logger,
StreamFactory $streamFactory,
PartStreamContainerFactory $partStreamContainerFactory,
PartHeaderContainerFactory $partHeaderContainerFactory,
PartChildrenContainerFactory $partChildrenContainerFactory
) {
parent::__construct($logger, $streamFactory, $partStreamContainerFactory);
$this->partHeaderContainerFactory = $partHeaderContainerFactory;
$this->partChildrenContainerFactory = $partChildrenContainerFactory;
}
/**
* Constructs a new IMimePart object and returns it
*/
public function newInstance(?IMimePart $parent = null) : IMimePart
{
$streamContainer = $this->partStreamContainerFactory->newInstance();
$headerContainer = $this->partHeaderContainerFactory->newInstance();
$part = new MimePart(
$parent,
$this->logger,
$streamContainer,
$headerContainer,
$this->partChildrenContainerFactory->newInstance()
);
$streamContainer->setStream($this->streamFactory->newMessagePartStream($part));
return $part;
}
}
@@ -0,0 +1,37 @@
<?php
/**
* This file is part of the ZBateson\MailMimeParser project.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*/
namespace ZBateson\MailMimeParser\Message\Factory;
use ZBateson\MailMimeParser\Message\IMimePart;
use ZBateson\MailMimeParser\Message\IUUEncodedPart;
use ZBateson\MailMimeParser\Message\UUEncodedPart;
/**
* Responsible for creating UUEncodedPart instances.
*
* @author Zaahid Bateson
*/
class IUUEncodedPartFactory extends IMessagePartFactory
{
/**
* Constructs a new UUEncodedPart object and returns it
*/
public function newInstance(?IMimePart $parent = null) : IUUEncodedPart
{
$streamContainer = $this->partStreamContainerFactory->newInstance();
$part = new UUEncodedPart(
null,
null,
$parent,
$this->logger,
$streamContainer
);
$streamContainer->setStream($this->streamFactory->newMessagePartStream($part));
return $part;
}
}
@@ -0,0 +1,23 @@
<?php
/**
* This file is part of the ZBateson\MailMimeParser project.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*/
namespace ZBateson\MailMimeParser\Message\Factory;
use ZBateson\MailMimeParser\Message\PartChildrenContainer;
/**
* Creates PartChildrenContainer instances.
*
* @author Zaahid Bateson
*/
class PartChildrenContainerFactory
{
public function newInstance() : PartChildrenContainer
{
return new PartChildrenContainer();
}
}
@@ -0,0 +1,45 @@
<?php
/**
* This file is part of the ZBateson\MailMimeParser project.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*/
namespace ZBateson\MailMimeParser\Message\Factory;
use Psr\Log\LoggerInterface;
use ZBateson\MailMimeParser\Header\HeaderFactory;
use ZBateson\MailMimeParser\Message\PartHeaderContainer;
/**
* Creates PartHeaderContainer instances.
*
* @author Zaahid Bateson
*/
class PartHeaderContainerFactory
{
protected LoggerInterface $logger;
/**
* @var HeaderFactory the HeaderFactory passed to HeaderContainer instances.
*/
protected HeaderFactory $headerFactory;
/**
* Constructor
*
*/
public function __construct(LoggerInterface $logger, HeaderFactory $headerFactory)
{
$this->logger = $logger;
$this->headerFactory = $headerFactory;
}
/**
* Creates and returns a PartHeaderContainer.
*/
public function newInstance(?PartHeaderContainer $from = null) : PartHeaderContainer
{
return new PartHeaderContainer($this->logger, $this->headerFactory, $from);
}
}
@@ -0,0 +1,51 @@
<?php
/**
* This file is part of the ZBateson\MailMimeParser project.
*
* @license http://opensource.org/licenses/bsd-license.php BSD
*/
namespace ZBateson\MailMimeParser\Message\Factory;
use Psr\Log\LoggerInterface;
use ZBateson\MailMimeParser\Message\PartStreamContainer;
use ZBateson\MailMimeParser\Stream\StreamFactory;
use ZBateson\MbWrapper\MbWrapper;
/**
* Creates PartStreamContainer instances.
*
* @author Zaahid Bateson
*/
class PartStreamContainerFactory
{
protected LoggerInterface $logger;
protected StreamFactory $streamFactory;
protected MbWrapper $mbWrapper;
protected bool $throwExceptionReadingPartContentFromUnsupportedCharsets;
public function __construct(
LoggerInterface $logger,
StreamFactory $streamFactory,
MbWrapper $mbWrapper,
bool $throwExceptionReadingPartContentFromUnsupportedCharsets
) {
$this->logger = $logger;
$this->streamFactory = $streamFactory;
$this->mbWrapper = $mbWrapper;
$this->throwExceptionReadingPartContentFromUnsupportedCharsets = $throwExceptionReadingPartContentFromUnsupportedCharsets;
}
public function newInstance() : PartStreamContainer
{
return new PartStreamContainer(
$this->logger,
$this->streamFactory,
$this->mbWrapper,
$this->throwExceptionReadingPartContentFromUnsupportedCharsets
);
}
}