static string YAMLDump(
array
$array, [int
$indent = false], [int
$wordwrap = false]
)
|
|
Dump YAML from PHP array statically
The dump method, when supplied with an array, will do its best to convert the array into friendly YAML. Pretty simple. Feel free to save the returned string as nothing.yaml and pass it around.
Oh, and you can decide how big the indent is and what the wordwrap for folding is. Pretty cool -- just pass in 'false' for either if you want to use the default.
Indent's default is 2 spaces, wordwrap's default is 40 characters. And you can turn off wordwrap by passing in 0.
Parameters:
|
array |
$array: |
PHP array |
|
int |
$indent: |
Pass in false to use the default, which is 2 |
|
int |
$wordwrap: |
Pass in 0 for no wordwrap, false for default (40) |
API Tags:
static array YAMLLoad(
string
$input
)
|
|
Load YAML into a PHP array statically
The load method, when supplied with a YAML stream (string or file), will do its best to convert YAML in a file into a PHP array. Pretty simple. Usage:
Parameters:
|
string |
$input: |
Path of YAML file or string containing YAML |
API Tags:
void addArray(
$array,
$indent
)
|
|
Parameters:
API Tags:
void addGroup(
$line,
$group
)
|
|
Parameters:
API Tags:
void addLiteralLine(
$literalBlock,
$line,
$literalBlockStyle
)
|
|
Parameters:
|
|
$literalBlock: |
|
|
|
$line: |
|
|
|
$literalBlockStyle: |
|
API Tags:
void clearBiggerPathValues(
$indent
)
|
|
Parameters:
API Tags:
string dump(
array
$array, [int
$indent = false], [int
$wordwrap = false]
)
|
|
Dump PHP array to YAML
The dump method, when supplied with an array, will do its best to convert the array into friendly YAML. Pretty simple. Feel free to save the returned string as tasteful.yaml and pass it around.
Oh, and you can decide how big the indent is and what the wordwrap for folding is. Pretty cool -- just pass in 'false' for either if you want to use the default.
Indent's default is 2 spaces, wordwrap's default is 40 characters. And you can turn off wordwrap by passing in 0.
Parameters:
|
array |
$array: |
PHP array |
|
int |
$indent: |
Pass in false to use the default, which is 2 |
|
int |
$wordwrap: |
Pass in 0 for no wordwrap, false for default (40) |
API Tags:
void getParentPathByIndent(
$indent
)
|
|
Parameters:
API Tags:
void isArrayElement(
$line
)
|
|
Parameters:
API Tags:
void isHashElement(
$line
)
|
|
Parameters:
API Tags:
void literalBlockContinues(
$line,
$lineIndent
)
|
|
Parameters:
API Tags:
void loadFromSource(
$input
)
|
|
Parameters:
API Tags:
void nodeContainsGroup(
$line
)
|
|
Parameters:
API Tags:
void returnArrayElement(
$line
)
|
|
Parameters:
API Tags:
void returnKeyValuePair(
$line
)
|
|
Parameters:
API Tags:
void returnMappedSequence(
$line
)
|
|
Parameters:
API Tags:
void returnMappedValue(
$line
)
|
|
Parameters:
API Tags:
void revertLiteralPlaceHolder(
$lineArray,
$literalBlock
)
|
|
Parameters:
|
|
$lineArray: |
|
|
|
$literalBlock: |
|
API Tags:
void startsLiteralBlock(
$line
)
|
|
Parameters:
API Tags:
void startsMappedSequence(
$line
)
|
|
Parameters:
API Tags:
void startsMappedValue(
$line
)
|
|
Parameters:
API Tags:
void stripGroup(
$line,
$group
)
|
|
Parameters:
API Tags:
void stripIndent(
$line, [
$indent = -1]
)
|
|
Parameters:
API Tags:
string _doFolding(
$value
$value,
$indent
)
|
|
Folds a string of text, if necessary
Parameters:
|
$value |
$value: |
The string you wish to fold |
|
|
$indent: |
|
API Tags:
string _doLiteralBlock(
$value
$value, $indent
$indent
)
|
|
Creates a literal block for dumping
Parameters:
|
$value |
$value: |
|
|
$indent |
$indent: |
int The value of the indent |
API Tags:
string _dumpNode(
$key
$key, $value
$value, $indent
$indent
)
|
|
Returns YAML from a key and a value
Parameters:
|
$key |
$key: |
The name of the key |
|
$value |
$value: |
The value of the item |
|
$indent |
$indent: |
The indent of the current node |
API Tags:
int _getIndent(
string
$line
)
|
|
Finds and returns the indentation of a YAML line
Parameters:
|
string |
$line: |
A line from the YAML file |
API Tags:
array _inlineEscape(
$inline
)
|
|
Used in inlines to check for more inlines or quoted strings
Parameters:
API Tags:
array _parseLine(
string
$line
)
|
|
Parses YAML code and returns an array for a node
Parameters:
|
string |
$line: |
A line from the YAML file |
API Tags:
mixed _toType(
string
$value
)
|
|
Finds the type of the passed value, returns the value as the new type.
Parameters:
API Tags:
string _yamlize(
$key
$key, $value
$value, $indent
$indent
)
|
|
Attempts to convert a key / value array item to YAML
Parameters:
|
$key |
$key: |
The name of the key |
|
$value |
$value: |
The value of the item |
|
$indent |
$indent: |
The indent of the current node |
API Tags:
string _yamlizeArray(
$array
$array, $indent
$indent
)
|
|
Attempts to convert an array to YAML
Parameters:
|
$array |
$array: |
The array you want to convert |
|
$indent |
$indent: |
The indent of the current level |
API Tags: