public function yamlParse($text)
    {
        if (function_exists("yaml_parse")) {
            // Prefer php5-yaml extension
            $parsed = yaml_parse($text);

            if ($parsed === false) {
                throw new Exception("Failed parsing YAML frontmatter.");
            }

            return $parsed;
        }

        if (method_exists("Symfony\Component\Yaml\Yaml", "parse")) {
            // symfony/yaml
            $parsed = \Symfony\Component\Yaml\Yaml::parse($text);
            return $parsed;
        }

        if (function_exists("spyc_load")) {
            // mustangostang/spyc
            $parsed = spyc_load($text);
            return $parsed;
        }

        throw new Exception("Could not find support for YAML.");
    }
public function yamlParse($text)
    {
        if (function_exists("yaml_parse")) {
            // Prefer php5-yaml extension
            $parsed = yaml_parse($text);

            if ($parsed === false) {
                throw new Exception("Failed parsing YAML frontmatter.");
            }

            return $parsed;
        }

        if (method_exists("Symfony\Component\Yaml\Yaml", "parse")) {
            // symfony/yaml
            $parsed = \Symfony\Component\Yaml\Yaml::parse($text);
            return $parsed;
        }

        if (function_exists("spyc_load")) {
            // mustangostang/spyc
            $parsed = spyc_load($text);
            return $parsed;
        }

        throw new Exception("Could not find support for YAML.");
    }
public function yamlParse ( $ text ) { if ( function_exists ( "yaml_parse" ) ) { // Prefer php5-yaml extension $ parsed = yaml_parse ( $ text ) ; if ( $ parsed === false ) { throw new Exception ( "Failed parsing YAML frontmatter." ) ; } return $ parsed ; } if ( method_exists ( "Symfony\Component\Yaml\Yaml" , "parse" ) ) { // symfony/yaml $ parsed = \ Symfony \ Component \ Yaml \ Yaml :: parse ( $ text ) ; return $ parsed ; } if ( function_exists ( "spyc_load" ) ) { // mustangostang/spyc $ parsed = spyc_load ( $ text ) ; return $ parsed ; } throw new Exception ( "Could not find support for YAML." ) ; }
Extract YAML front matter from text, use one of several available
implementations of a YAML parser.

@deprecated since 1.2, replaced with filter\Frontmatter.

@param string $text the text to be parsed.

@throws: Exception when parsing frontmatter fails.

@return array with the formatted text and the front matter.
Extract YAML front matter from text use one of several available implementations of a YAML parser .