protected function parseYaml($text)
    {
        if ($this->config["yaml_parser_pecl"]
            && function_exists("yaml_parse")
        ) {
            // PECL php5-yaml extension
            $parsed = yaml_parse($text);

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

        if ($this->config["yaml_parser_symfony"]
            && method_exists("Symfony\Component\Yaml\Yaml", "parse")
        ) {
            // symfony/yaml
            $parsed = Yaml::parse($text);
            return $parsed;
        }

        if ($this->config["yaml_parser_spyc"]
            && function_exists("spyc_load")
        ) {
            // mustangostang/spyc
            $parsed = spyc_load($text);
            return $parsed;
        }

        throw new Exception("Could not find support for YAML.");
    }
protected function parseYaml($text)
    {
        if ($this->config["yaml_parser_pecl"]
            && function_exists("yaml_parse")
        ) {
            // PECL php5-yaml extension
            $parsed = yaml_parse($text);

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

        if ($this->config["yaml_parser_symfony"]
            && method_exists("Symfony\Component\Yaml\Yaml", "parse")
        ) {
            // symfony/yaml
            $parsed = Yaml::parse($text);
            return $parsed;
        }

        if ($this->config["yaml_parser_spyc"]
            && function_exists("spyc_load")
        ) {
            // mustangostang/spyc
            $parsed = spyc_load($text);
            return $parsed;
        }

        throw new Exception("Could not find support for YAML.");
    }
protected function parseYaml ( $ text ) { if ( $ this -> config [ "yaml_parser_pecl" ] && function_exists ( "yaml_parse" ) ) { // PECL php5-yaml extension $ parsed = yaml_parse ( $ text ) ; if ( $ parsed === false ) { throw new Exception ( "Failed parsing YAML frontmatter using PECL." ) ; } return $ parsed ; } if ( $ this -> config [ "yaml_parser_symfony" ] && method_exists ( "Symfony\Component\Yaml\Yaml" , "parse" ) ) { // symfony/yaml $ parsed = Yaml :: parse ( $ text ) ; return $ parsed ; } if ( $ this -> config [ "yaml_parser_spyc" ] && function_exists ( "spyc_load" ) ) { // mustangostang/spyc $ parsed = spyc_load ( $ text ) ; return $ parsed ; } throw new Exception ( "Could not find support for YAML." ) ; }
Parse YAML front matter from text, use one of several available
implementations of a YAML parser.

@param string $text the YAML to parsed.

@return void.

@throws Exception when parsing frontmatter fails of is not installed.
Parse YAML front matter from text use one of several available implementations of a YAML parser .