class PoStreamWriter implements PoWriterInterface, PoStreamInterface (View source)

Defines a Gettext PO stream writer.

Properties

protected string $uri

URI of the PO stream that is being written.

protected PoHeader $header

The Gettext PO header.

protected resource $fd

File handle of the current PO stream.

protected string $langcode

The language code of this writer.

Methods

getHeader()

Gets the PO header of the current stream.

setHeader(PoHeader $header)

Set the PO header for the current stream.

string
getLangcode()

Gets the current language code used.

setLangcode(string $langcode)

Set the language code.

open()

Open the stream. Set the URI for the stream earlier with setURI().

close()

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

writeItem(PoItem $item)

Writes the given item.

writeItems(PoReaderInterface $reader, $count = -1)

Writes all or the given amount of items.

URI
getURI()

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

setURI($uri)

Set the URI of the PO stream that is going to be read or written.

Details

PoHeader getHeader()

Gets the PO header of the current stream.

Return Value

PoHeader

Header instance representing metadata in a PO header.

setHeader(PoHeader $header)

Set the PO header for the current stream.

Parameters

PoHeader $header

Header object representing metadata in a PO header.

string getLangcode()

Gets the current language code used.

Return Value

string

Language code string.

setLangcode(string $langcode)

Set the language code.

Parameters

string $langcode

Language code string.

open()

Open the stream. Set the URI for the stream earlier with setURI().

close()

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

Exceptions

Exception

writeItem(PoItem $item)

Writes the given item.

Parameters

PoItem $item

One specific item to write.

writeItems(PoReaderInterface $reader, $count = -1)

Writes all or the given amount of items.

Parameters

PoReaderInterface $reader

Reader to read PoItems from.

$count

Amount of items to read from $reader to write. If -1, all items are read from $reader.

URI getURI()

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

Return Value

URI

string for this stream.

Exceptions

Exception

setURI($uri)

Set the URI of the PO stream that is going to be read or written.

Parameters

$uri

URI string to set for this stream.