public function PoStreamReader::open

public 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.');
  }
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!Gettext!PoStreamReader.php/function/PoStreamReader::open/8.1.x