You are here

public function PoStreamReader::open in Localization update 7.2

Implements 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

includes/gettext/PoStreamReader.php, line 160
Contains \Drupal\Component\Gettext\PoStreamReader.

Class

PoStreamReader
Implements Gettext PO stream reader.

Code

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