function PoStreamWriter::write

Same name in other branches
  1. 9 core/lib/Drupal/Component/Gettext/PoStreamWriter.php \Drupal\Component\Gettext\PoStreamWriter::write()
  2. 10 core/lib/Drupal/Component/Gettext/PoStreamWriter.php \Drupal\Component\Gettext\PoStreamWriter::write()
  3. 11.x core/lib/Drupal/Component/Gettext/PoStreamWriter.php \Drupal\Component\Gettext\PoStreamWriter::write()

Write data to the stream.

Parameters

string $data: Piece of string to write to the stream. If the value is not directly a string, casting will happen in writing.

Throws

\Exception If writing the data is not possible.

2 calls to PoStreamWriter::write()
PoStreamWriter::writeHeader in core/lib/Drupal/Component/Gettext/PoStreamWriter.php
Write the PO header to the stream.
PoStreamWriter::writeItem in core/lib/Drupal/Component/Gettext/PoStreamWriter.php
Writes the given item.

File

core/lib/Drupal/Component/Gettext/PoStreamWriter.php, line 113

Class

PoStreamWriter
Defines a Gettext PO stream writer.

Namespace

Drupal\Component\Gettext

Code

private function write($data) {
    $result = fwrite($this->fd, $data);
    if ($result === FALSE || $result != strlen($data)) {
        throw new \Exception('Unable to write data: ' . substr($data, 0, 20));
    }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.