class Tokenifier (View source)

Transforms a string to a list of tokens.

Properties

string $escape Escape character.
string[] $whitespaces White space character list.
string[] $escapables List of additional escapable characters.

Methods

addQuotingPair(stringown $start, string|NULL $end = null)

Add new quoting pair

setStringFunctions(callable $length, callable $split)

No description

clearQuotingPairs()

Remove all quoting pair definitions

string[]
__invoke(string $text)

No description

getEscapables($quotingPair)

No description

findStartingQuute($offset, $character)

No description

Details

addQuotingPair(stringown $start, string|NULL $end = null)

Add new quoting pair

Parameters

stringown $start Opening quote
string|NULL $end Closing quoute. If NULL, use opening quote.

setStringFunctions(callable $length, callable $split)

Parameters

callable $length strlen compatible function
callable $split str_split compatible function

clearQuotingPairs()

Remove all quoting pair definitions

string[] __invoke(string $text)

Parameters

string $text

Return Value

string[] List of tokens

Exceptions

InvalidArgumentException

protected getEscapables($quotingPair)

Parameters

$quotingPair

protected findStartingQuute($offset, $character)

Parameters

$offset
$character