__construct (Constructor) [line 78]
File_Therion_Line __construct(
string|array
$data, [string
$comment = ''], [string
$indent = ''])
|
|
Create a new therion line object.
Data may be given in two forms:
- string: line data will be used as given (like from file)
- array: interpreted as array returned by getDatafields()
Be sure to escape values in string mode properly.
Parameters:
addData [line 157]
void addData(
string
$indent, string
$data, string
$comment)
|
|
Add internal data to stack.
Parameters:
addPhysicalLine [line 132]
Add a physical Therion line as wrapped into its contents.
Parameters:
changeEOL [line 732]
void changeEOL(
string
$eol)
|
|
Change default End-of-Line characters of string representation.
The default EOL is PHP_EOL, eg. the local platform EOL.
Use this to change the EOL character to an platform dependant char sequence; for example to generate windows files from linux.
Parameters:
checkSyntax_keyword [line 782]
boolean checkSyntax_keyword(
string
$subject, [boolean
$extended = false])
|
|
Check syntax on Therion keywords.
Therion keywords are a sequence of A-Z, a-z, 0-9 and _-/ characters (not starting with ‘-’). Extended keyword can also contain +*.,' characters, but not on the first position.
Parameters:
count [line 717]
Count (wrapped) lines in this line (SPL Countable).
returns the raw value of lines. Ususally 1, however if the line contains wrapped data, it will return the 'true' count of those lines as they would appear in a textual representation.
escape [line 466]
string|array escape(
string|array
$value)
|
|
Escapes one or more datafields for proper therion syntax.
This will escape and quote datafields properly, so the can be put into a file for writing.
Escaping and quoting rules are described in the therion book at p. 12.
When passed an array (like from getDatafields(), an array will be returned with each value escaped separately.
Parameters:
expectMoreLines [line 222]
void expectMoreLines(
[boolean
$yesno = true])
|
|
Let the Line know that it should expect an additional wrapped line.
Do not confuse this with isContinued()!
Parameters:
extractOptions [line 384]
array extractOptions(
[boolean
$inverse = false])
|
|
Extract options given to a command in this line.
Returns associative array of set options with key=option. The value is an array containing the values whose items can have the following forms:
- empty string with no arguments
- string when one argument was given
- array with strings with multiple arguments
When an option is given more than once, value(s) will be appended to the already existing key like described above.
If inverting is selected, the fields that are non options are returned as indexed array in order of appearance.
Example: //Line = 'survey foo -title "bar foo passage"'
print $options['title']; // -> array("bar foo passage")
//Line = 'scrap bar -author 2016 "Some One"'
print $options['author']; // -> array(array("2016", "Some One"))
//Line = 'scrap bar -author 2016 "Some One" -author "Someone Else"'
print $options['author']; // -> array(array("2016", "Some One"), "Someone Else")
//Inverting, that is filter out options
//Line = 'survey foo -title "bar foo passage"'
print_r($options);
// -> array("survey", "foo")
Parameters:
filterNonEmpty [line 752]
int filterNonEmpty(
array
$arrayToCount)
|
|
Filter empty Therion data lines out of array.
Returns the lines that are not only commentary or empty; that is: lines with real content.
Parameters:
getComment [line 528]
string getComment(
[string
$ml_sep = '; '])
|
|
Returns the unwrapped comment as string.
Comments of wrapped lines will be joined.
Parameters:
getContent [line 243]
Returns the unwrapped data-content as string.
Comments and indenting will be stripped
getDatafields [line 269]
Returns the data part of the line as array.
Each distinct value will form one array index. With single line therion commands the command will be naturally at i=0, whereas with multiline commands there will usually just be data.
Unescaping will be performed, so each array entry has only valid data suitable for proper processing.
If the line is empty (ie it has the empty string as content), an empty array will be returned.
getIndent [line 548]
Returns the indenting characters.
In case this line contains wrapped content, the indenting of the first physical line will be used.
isCommentOnly [line 596]
Say if this is just a comment or empty line.
isContinuation [line 640]
Detect if the line is a continuation of a wrapped one.
This cannot be derived from the current line. The current line can be expected to be a continuation in case the preceeding line expects more content (that it does not contian itself), eg it was endet with an backslash. Such lines may be consolidatet into one single Therion_Line object using addPhysicalLine() on the prior line with the inspected one as parameter: '
'.
Parameters:
isContinued [line 609]
Detect if this Line expects wrapped content in the following physical line.
isWrapped [line 620]
Detect if this logical Line contains wrapped physical data.
parse [line 104]
Parse a physical Therion line into its contents.
Parameters:
setCommentSeparator [line 673]
void setCommentSeparator(
string
$separator)
|
|
Set separator for appending comments to datalines in output (toString().
Parameters:
setContent [line 699]
void setContent(
string
$data)
|
|
Set payload of the line.
This reverts the line to consist of a single line with the payload. The indentation and comment stay intact.
Parameters:
setIndent [line 685]
void setIndent(
string
$indent)
|
|
Set indenting for output (toString().
Parameters:
toLines [line 586]
Return this line as object.
This is mainly useful for internal processing when lines of subobjects are requested in bulk.
toString [line 561]
Returns the whole line as String.
Comments will be added using a single tabulator by default. Line ending is the current value of PHP_EOL (NEWLINE on *NIX).
unescape [line 500]
string|array unescape(
string|array
$value)
|
|
Unescapes one or more datafields for proper processing in PHP.
This will undo the escaping and quoting performed by escape().
Parameters:
__toString [line 575]
Magic __toString() method calls toString().