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

Breadcrumb

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

function AbstractStream::write

File

vendor/symfony/mailer/Transport/Smtp/Stream/AbstractStream.php, line 37

Class

AbstractStream
A stream supporting remote sockets and local processes.

Namespace

Symfony\Component\Mailer\Transport\Smtp\Stream

Code

public function write(string $bytes, bool $debug = true) : void {
    if ($debug) {
        $timestamp = (new \DateTimeImmutable())->format('Y-m-d\\TH:i:s.up');
        foreach (explode("\n", trim($bytes)) as $line) {
            $this->debug .= \sprintf("[%s] > %s\n", $timestamp, $line);
        }
    }
    $bytesToWrite = \strlen($bytes);
    $totalBytesWritten = 0;
    while ($totalBytesWritten < $bytesToWrite) {
        $bytesWritten = @fwrite($this->in, substr($bytes, $totalBytesWritten));
        if (false === $bytesWritten || 0 === $bytesWritten) {
            throw new TransportException('Unable to write bytes on the wire.');
        }
        $totalBytesWritten += $bytesWritten;
    }
}

API Navigation

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