Add $objectForMap as argument of Yaml::parse()

This commit is contained in:
Rémi Blaise 2015-04-19 18:34:12 +02:00
parent 8cf0613ead
commit 238589d4e8

View File

@ -41,6 +41,7 @@ class Yaml
* @param string $input Path to a YAML file or a string containing YAML
* @param bool $exceptionOnInvalidType True if an exception must be thrown on invalid types false otherwise
* @param bool $objectSupport True if object support is enabled, false otherwise
* @param bool $objectForMap True if maps should return a stdClass instead of array()
*
* @return array The YAML converted to a PHP array
*
@ -50,7 +51,7 @@ class Yaml
*
* @api
*/
public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false)
public static function parse($input, $exceptionOnInvalidType = false, $objectSupport = false, $objectForMap = false)
{
// if input is a file, process it
$file = '';
@ -68,7 +69,7 @@ class Yaml
$yaml = new Parser();
try {
return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport);
return $yaml->parse($input, $exceptionOnInvalidType, $objectSupport, $objectForMap);
} catch (ParseException $e) {
if ($file) {
$e->setParsedFile($file);