$parser = new Spyc;
$array = $parser->load($file);
Afficher le fichier
Open project: mustangostang/spyc
Class Usage Examples
Свойство | Type | Description | |
---|---|---|---|
$_nodeId | |||
$setting_dump_force_quotes | boolean | Setting this to true will force YAMLDump to enclose any string value in quotes. False by default. | |
$setting_use_syck_is_possible | boolean | Setting this to true will forse YAMLLoad to use syck_load function when possible. False by default. |
Méthode | Description | |
---|---|---|
YAMLDump ( array $array, integer $indent = false, integer $wordwrap = false, integer $no_opening_dashes = false ) : string | Dump YAML from PHP array statically | |
YAMLLoad ( string $input ) : array | Load YAML into a PHP array statically | |
YAMLLoadString ( string $input ) : array | Load a string of YAML into a PHP array statically | |
dump ( array $array, integer $indent = false, integer $wordwrap = false, $no_opening_dashes = false ) : string | Dump PHP array to YAML | |
load ( string $input ) : array | Load a valid YAML string to Spyc. | |
loadFile ( string $file ) : array | Load a valid YAML file to Spyc. | |
revertLiteralPlaceHolder ( $lineArray, $literalBlock ) |
Méthode | Description | |
---|---|---|
__load ( $input ) | LOADING FUNCTIONS | |
__loadString ( $input ) | ||
_doFolding ( $value, $indent ) : string | Folds a string of text, if necessary | |
_doLiteralBlock ( $value, $indent ) : string | Creates a literal block for dumping | |
_dumpNode ( $key, $value, $indent, $previous_key, $first_key, $source_array = null ) : string | Returns YAML from a key and a value | |
_inlineEscape ( $inline ) : array | Used in inlines to check for more inlines or quoted strings | |
_parseLine ( string $line ) : array | Parses YAML code and returns an array for a node | |
_toType ( string $value ) : mixed | Finds the type of the passed value, returns the value as the new type. | |
_yamlize ( $key, $value, $indent, $previous_key, $first_key, $source_array = null ) : string | Attempts to convert a key / value array item to YAML | |
_yamlizeArray ( $array, $indent ) : string | Attempts to convert an array to YAML | |
addArray ( $incoming_data, $incoming_indent ) | ||
addArrayInline ( $array, $indent ) | ||
addGroup ( $line, $group ) | ||
addLiteralLine ( $literalBlock, $line, $literalBlockStyle, $indent ) | ||
checkKeysInValue ( $value ) | ||
clearBiggerPathValues ( $indent ) | ||
coerceValue ( &$value ) | Coerce a string into a native type Reference: http://yaml.org/type/bool.html TODO: Use only words from the YAML spec. | |
getParentPathByIndent ( $indent ) | ||
getTranslations ( array $words ) | Given a set of words, perform the appropriate translations on them to match the YAML 1.1 specification for type coercing. | |
greedilyNeedNextLine ( $line ) | ||
isArrayElement ( $line ) | ||
isComment ( $line ) | ||
isEmpty ( $line ) | ||
isFalseWord ( $value ) | ||
isHashElement ( $line ) | ||
isLiteral ( $line ) | ||
isNullWord ( $value ) | ||
isPlainArray ( $line ) | ||
isTranslationWord ( $value ) | ||
isTrueWord ( $value ) | ||
literalBlockContinues ( $line, $lineIndent ) | ||
loadFromSource ( $input ) | ||
loadFromString ( $input ) | ||
loadWithSource ( $Source ) | ||
nodeContainsGroup ( $line ) | ||
referenceContentsByAlias ( $alias ) | ||
returnArrayElement ( $line ) | ||
returnKeyValuePair ( $line ) | ||
returnMappedSequence ( $line ) | ||
returnMappedValue ( $line ) | ||
returnPlainArray ( $line ) | ||
startsLiteralBlock ( $line ) | ||
startsMappedSequence ( $line ) | ||
startsMappedValue ( $line ) | ||
stripGroup ( $line, $group ) | ||
stripIndent ( $line, $indent ) | ||
unquote ( $value ) |
public static YAMLDump ( array $array, integer $indent = false, integer $wordwrap = false, integer $no_opening_dashes = false ) : string | ||
$array | array | PHP array |
$indent | integer | Pass in false to use the default, which is 2 |
$wordwrap | integer | Pass in 0 for no wordwrap, false for default (40) |
$no_opening_dashes | integer | Do not start YAML file with "---\n" |
Résultat | string |
$array = Spyc::YAMLLoad('lucky.yaml');
print_r($array);
$array = Spyc::YAMLLoadString("---\n0: hello world\n");
print_r($array);
public static YAMLLoadString ( string $input ) : array | ||
$input | string | String containing YAML |
Résultat | array |
public revertLiteralPlaceHolder ( $lineArray, $literalBlock ) |
public bool $setting_dump_force_quotes | ||
Résultat | boolean |
public bool $setting_use_syck_is_possible | ||
Résultat | boolean |