<?php /* * This file is part of the Symfony package. * * (c) Fabien Potencier <fabien@symfony.com> * * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Mime; use Symfony\Component\Mime\Exception\LogicException; /** * @author Fabien Potencier <fabien@symfony.com> */ class RawMessage { private $message; public function __construct(iterable|string $message) { $this->message = $message; } public function toString(): string { if (\is_string($this->message)) { return $this->message; } if ($this->message instanceof \Traversable) { $this->message = iterator_to_array($this->message, false); } return $this->message = implode('', $this->message); } public function toIterable(): iterable { if (\is_string($this->message)) { yield $this->message; return; } $message = ''; foreach ($this->message as $chunk) { $message .= $chunk; yield $chunk; } $this->message = $message; } /** * @throws LogicException if the message is not valid */ public function ensureValidity() { } public function __serialize(): array { return [$this->toString()]; } public function __unserialize(array $data): void { [$this->message] = $data; } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
.git | Folder | 0755 |
|
|
Crypto | Folder | 0755 |
|
|
DependencyInjection | Folder | 0755 |
|
|
Encoder | Folder | 0755 |
|
|
Exception | Folder | 0755 |
|
|
Header | Folder | 0755 |
|
|
HtmlToTextConverter | Folder | 0755 |
|
|
Part | Folder | 0755 |
|
|
Resources | Folder | 0755 |
|
|
Test | Folder | 0755 |
|
|
Tests | Folder | 0755 |
|
|
.gitattributes | File | 113 B | 0644 |
|
.gitignore | File | 37 B | 0644 |
|
Address.php | File | 3.75 KB | 0644 |
|
BodyRendererInterface.php | File | 438 B | 0644 |
|
CHANGELOG.md | File | 851 B | 0644 |
|
CharacterStream.php | File | 9.36 KB | 0644 |
|
DraftEmail.php | File | 1.14 KB | 0644 |
|
Email.php | File | 15.52 KB | 0644 |
|
FileBinaryMimeTypeGuesser.php | File | 2.49 KB | 0644 |
|
FileinfoMimeTypeGuesser.php | File | 1.84 KB | 0644 |
|
LICENSE | File | 1.06 KB | 0644 |
|
Message.php | File | 4.51 KB | 0644 |
|
MessageConverter.php | File | 5.15 KB | 0644 |
|
MimeTypeGuesserInterface.php | File | 859 B | 0644 |
|
MimeTypes.php | File | 179.96 KB | 0644 |
|
MimeTypesInterface.php | File | 809 B | 0644 |
|
README.md | File | 472 B | 0644 |
|
RawMessage.php | File | 1.55 KB | 0644 |
|
composer.json | File | 1.4 KB | 0644 |
|
phpunit.xml.dist | File | 893 B | 0644 |
|