public static function parse($content)
    {
        $matter = array();

        $text = str_replace(PHP_EOL, $id = uniqid(), $content);

        $regex = '/^---' . $id . '(.*?)' . $id . '---/';

        if (preg_match($regex, $text, $matches) === 1) {
            $yaml = str_replace($id, PHP_EOL, $matches[1]);

            $matter = (array) Yaml::parse(trim($yaml));

            $body = str_replace($matches[0], '', $text);

            $content = str_replace($id, PHP_EOL, $body);
        }

        return array($matter, (string) trim($content));
    }
public static function parse($content)
    {
        $matter = array();

        $text = str_replace(PHP_EOL, $id = uniqid(), $content);

        $regex = '/^---' . $id . '(.*?)' . $id . '---/';

        if (preg_match($regex, $text, $matches) === 1) {
            $yaml = str_replace($id, PHP_EOL, $matches[1]);

            $matter = (array) Yaml::parse(trim($yaml));

            $body = str_replace($matches[0], '', $text);

            $content = str_replace($id, PHP_EOL, $body);
        }

        return array($matter, (string) trim($content));
    }
public static function parse ( $ content ) { $ matter = array ( ) ; $ text = str_replace ( PHP_EOL , $ id = uniqid ( ) , $ content ) ; $ regex = '/^---' . $ id . '(.*?)' . $ id . '---/' ; if ( preg_match ( $ regex , $ text , $ matches ) === 1 ) { $ yaml = str_replace ( $ id , PHP_EOL , $ matches [ 1 ] ) ; $ matter = ( array ) Yaml :: parse ( trim ( $ yaml ) ) ; $ body = str_replace ( $ matches [ 0 ] , '' , $ text ) ; $ content = str_replace ( $ id , PHP_EOL , $ body ) ; } return array ( $ matter , ( string ) trim ( $ content ) ) ; }
Retrieves the contents from a YAML format.

@param  string $content
@return array
Retrieves the contents from a YAML format .