Korin API

WriteOptions
in package

Read onlyYes
FinalYes

Table of Contents

Constants

MAX_LINE_LENGTH_5  : mixed = 255
5.5, 5.5.1 and 5.5.5: a line, terminator included, has at most 255 characters.

Properties

$bom  : bool|null
$encoding  : Encoding|null
$lineEnding  : string|null
$maxLineLength  : int
$mode  : WriteMode

Methods

__construct()  : mixed
normalize()  : self
Every line written anew by the version's rules, with one line terminator.
preserve()  : self
Unchanged lines byte for byte; changed and new lines by the version's rules.
withBom()  : self
Whether the output starts with a byte order mark; null decides as described in the constructor.
withEncoding()  : self
Writes in another encoding; unchanged lines are re-encoded and keep their terminators.
withLineEnding()  : self
Terminator for new and changed lines (every line when normalizing); null keeps the document's dominant one.
withMaxLineLength()  : self
Longest changed or new line in 5.x, terminator included; longer values are split into CONC lines.

Constants

MAX_LINE_LENGTH_5

5.5, 5.5.1 and 5.5.5: a line, terminator included, has at most 255 characters.

public mixed MAX_LINE_LENGTH_5 = 255

Properties

$maxLineLength

public int $maxLineLength = self::MAX_LINE_LENGTH_5

Methods

__construct()

public __construct([WriteMode $mode = WriteMode::Preserve ][, string|null $lineEnding = null ][, int $maxLineLength = self::MAX_LINE_LENGTH_5 ][, Encoding|null $encoding = null ][, bool|null $bom = null ]) : mixed
Parameters
$mode : WriteMode = WriteMode::Preserve
$lineEnding : string|null = null
$maxLineLength : int = self::MAX_LINE_LENGTH_5
$encoding : Encoding|null = null

null keeps the document's encoding

$bom : bool|null = null

null: as in the source in preserve mode (when the encoding is kept), otherwise by the version's rules (SPEC section 3)

normalize()

Every line written anew by the version's rules, with one line terminator.

public static normalize() : self
Return values
self

preserve()

Unchanged lines byte for byte; changed and new lines by the version's rules.

public static preserve() : self
Return values
self

withBom()

Whether the output starts with a byte order mark; null decides as described in the constructor.

public withBom(bool|null $bom) : self
Parameters
$bom : bool|null
Return values
self

withEncoding()

Writes in another encoding; unchanged lines are re-encoded and keep their terminators.

public withEncoding(Encoding|null $encoding) : self

HEAD.CHAR is not changed. A character the encoding lacks throws UnencodableCharacterException.

Parameters
$encoding : Encoding|null
Return values
self

withLineEnding()

Terminator for new and changed lines (every line when normalizing); null keeps the document's dominant one.

public withLineEnding(string|null $lineEnding) : self
Parameters
$lineEnding : string|null
Return values
self

withMaxLineLength()

Longest changed or new line in 5.x, terminator included; longer values are split into CONC lines.

public withMaxLineLength(int $maxLineLength) : self

Characters for UTF-8 and UTF-16, bytes for the other encodings. 7.0 has no CONC and no limit.

Parameters
$maxLineLength : int
Return values
self
On this page

Search results