PHP 8.3.31
Preview: Base64ContentEncoder.php Size: 1.30 KB
/home/getspomw/royalsquad.us/vendor/symfony/mime/Encoder/Base64ContentEncoder.php

<?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\Encoder;

use Symfony\Component\Mime\Exception\RuntimeException;

/**
 * @author Fabien Potencier <fabien@symfony.com>
 */
final class Base64ContentEncoder extends Base64Encoder implements ContentEncoderInterface
{
    public function encodeByteStream($stream, int $maxLineLength = 0): iterable
    {
        if (!\is_resource($stream)) {
            throw new \TypeError(\sprintf('Method "%s" takes a stream as a first argument.', __METHOD__));
        }

        $filter = stream_filter_append($stream, 'convert.base64-encode', \STREAM_FILTER_READ, [
            'line-length' => 0 >= $maxLineLength || 76 < $maxLineLength ? 76 : $maxLineLength,
            'line-break-chars' => "\r\n",
        ]);
        if (!\is_resource($filter)) {
            throw new RuntimeException('Unable to set the base64 content encoder to the filter.');
        }

        while (!feof($stream)) {
            yield fread($stream, 16372);
        }
        stream_filter_remove($filter);
    }

    public function getName(): string
    {
        return 'base64';
    }
}

Directory Contents

Dirs: 0 × Files: 14

Name Size Perms Modified Actions
689 B lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
1.30 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
1.25 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
1.26 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
668 B lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
834 B lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
717 B lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
10.01 KB lrw-r--r-- 2026-04-26 08:36:12
Edit Download
1.28 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
467 B lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
1.69 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
7.67 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
1.05 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download
1.40 KB lrw-rw-rw- 2025-09-17 06:53:20
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).