LinesIterator
in package
implements
Iterator
FinalYes
Table of Contents
Interfaces
- Iterator
Properties
Methods
- atStart() : bool
- current() : string
- getNextLine() : string|null
- isBlockLine() : bool
- Is this line "indented"?
- isEmpty() : bool
- isEmptyLine() : bool
- isIndented() : bool
- Check if line is an indented one.
- isNullOrEmptyLine() : bool
- key() : int
- load() : void
- next() : void
- peek() : string|null
- Moves the lookahead token forward.
- prev() : void
- rewind() : void
- toArray() : array<string|int, string>
- valid() : bool
- isIndentedBy() : bool
- prepareDocument() : string
Properties
$lines
private
array<string|int, string>
$lines
= []
$peek
private
int
$peek
= 1
$position
private
int
$position
= 0
Methods
atStart()
public
atStart() : bool
Return values
boolcurrent()
public
current() : string
Return values
stringgetNextLine()
public
getNextLine() : string|null
Return values
string|nullisBlockLine()
Is this line "indented"?
public
static isBlockLine(string|null $line[, int $minIndent = 1 ]) : bool
A blank line also counts as a "block" line, as it may be the empty line between, for example, a ".. note::" directive and the indented content on the next lines.
Parameters
- $line : string|null
- $minIndent : int = 1
-
can be used to require a specific level of indentation for non-blank lines (number of spaces)
Return values
boolisEmpty()
public
isEmpty() : bool
Return values
boolisEmptyLine()
public
static isEmptyLine(string|null $line) : bool
Parameters
- $line : string|null
Tags
Return values
boolisIndented()
Check if line is an indented one.
public
static isIndented(string $line, int $minIndent) : bool
This does not include blank lines, use isBlockLine() to check for blank or indented lines.
Parameters
- $line : string
- $minIndent : int
-
can be used to require a specific level of indentation (number of spaces)
Return values
boolisNullOrEmptyLine()
public
static isNullOrEmptyLine(string|null $line) : bool
Parameters
- $line : string|null
Tags
Return values
boolkey()
public
key() : int
Return values
intload()
public
load(string $document[, bool $preserveSpace = false ]) : void
Parameters
- $document : string
- $preserveSpace : bool = false
next()
public
next() : void
peek()
Moves the lookahead token forward.
public
peek() : string|null
Return values
string|nullprev()
public
prev() : void
Work around for Production's eating one line too many
Tags
rewind()
public
rewind() : void
toArray()
public
toArray() : array<string|int, string>
Return values
array<string|int, string>valid()
public
valid() : bool
Return values
boolisIndentedBy()
private
static isIndentedBy(string $line, int $minIndent, string $indentationChar) : bool
Parameters
- $line : string
- $minIndent : int
- $indentationChar : string
Return values
boolprepareDocument()
private
prepareDocument(string $document) : string
Parameters
- $document : string