function PoStreamWriter::close

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

Implements Drupal\Component\Gettext\PoStreamInterface::close().

Throws

\Exception If the stream is not open.

Overrides PoStreamInterface::close

File

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

Class

PoStreamWriter
Defines a Gettext PO stream writer.

Namespace

Drupal\Component\Gettext

Code

public function close() {
    if ($this->fd) {
        fclose($this->fd);
    }
    else {
        throw new \Exception('Cannot close stream that is not open.');
    }
}

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