Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Base64ContentEncoder.php

class Base64ContentEncoder

@author Fabien Potencier <fabien@symfony.com>

Hierarchy

  • class \Symfony\Component\Mime\Encoder\Base64Encoder implements \Symfony\Component\Mime\Encoder\EncoderInterface
    • class \Symfony\Component\Mime\Encoder\Base64ContentEncoder extends \Symfony\Component\Mime\Encoder\Base64Encoder implements \Symfony\Component\Mime\Encoder\ContentEncoderInterface

Expanded class hierarchy of Base64ContentEncoder

1 file declares its use of Base64ContentEncoder
TextPart.php in vendor/symfony/mime/Part/TextPart.php

File

vendor/symfony/mime/Encoder/Base64ContentEncoder.php, line 19

Namespace

Symfony\Component\Mime\Encoder
View source
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';
    }

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
Base64ContentEncoder::encodeByteStream public function Encodes the stream to a Generator. Overrides ContentEncoderInterface::encodeByteStream
Base64ContentEncoder::getName public function Gets the MIME name of this content encoding scheme. Overrides ContentEncoderInterface::getName
Base64Encoder::encodeString public function Takes an unencoded string and produces a Base64 encoded string from it. Overrides EncoderInterface::encodeString 1

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal