function PoStreamReader::open

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

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

Opens the stream and reads the header. The stream is ready for reading items after.

Throws

\Exception If the URI is not yet set.

Overrides PoStreamInterface::open

File

core/lib/Drupal/Component/Gettext/PoStreamReader.php, line 152

Class

PoStreamReader
Implements Gettext PO stream reader.

Namespace

Drupal\Component\Gettext

Code

public function open() {
    if (!empty($this->uri)) {
        $this->fd = fopen($this->uri, 'rb');
        $this->readHeader();
    }
    else {
        throw new \Exception('Cannot open stream without URI set.');
    }
}

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