LinesIterator
in package
implements
Iterator, Countable
FinalYes
Table of Contents
Interfaces
- Iterator
- Countable
Properties
- $leadingLinesRemoved : int
- $lines : string[]
- $peek : int
- $position : int
Methods
- atStart() : bool
- count() : int
- current() : string
- getLeadingLinesRemoved() : int
- Number of empty lines removed from the start of the document by load(), so that line numbers can still be mapped back to the loaded document.
- 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() : string[]
- valid() : bool
- isIndentedBy() : bool
- prepareDocument() : string
Properties
$leadingLinesRemoved
private
int
$leadingLinesRemoved
= 0
$lines
private
string[]
$lines
= []
$peek
private
int
$peek
= 1
$position
private
int
$position
= 0
Methods
atStart()
public
atStart() : bool
Return values
boolcount()
public
count() : int
Return values
intcurrent()
public
current() : string
Return values
stringgetLeadingLinesRemoved()
Number of empty lines removed from the start of the document by load(), so that line numbers can still be mapped back to the loaded document.
public
getLeadingLinesRemoved() : int
Return values
intgetNextLine()
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() : string[]
Return values
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