function FrontMatter($input)
    {
        if (!$this->startsWith($input, $this->yaml_separator)) {
            # No front matter
            # Store Content in Final array
            $final['content'] = $input;
            # Return Final array
            return $final;
        }

        # Explode Seperators. At most, make three pieces out of the input file
        $document = explode($this->yaml_separator,$input, 3);
        
        switch( sizeof($document) ) {
            case 0:
            case 1:
                // Empty document
                $front_matter = "";
                $content = "";
                break;
            case 2:
                # Only front matter given
                $front_matter = $document[1];
                $content = "";
                break;
            default:
                # Normal document
                $front_matter = $document[1];
                $content = $document[2];
        }
        
        # Parse YAML
		try {
			$final = Yaml::parse($front_matter);
		} catch (ParseException $e) {
			printf("Unable to parse the YAML string: %s", $e->getMessage());
		}
        
        # Store Content in Final array
        $final['content'] = $content;
        
        # Return Final array
        return $final;
    }
function FrontMatter($input)
    {
        if (!$this->startsWith($input, $this->yaml_separator)) {
            # No front matter
            # Store Content in Final array
            $final['content'] = $input;
            # Return Final array
            return $final;
        }

        # Explode Seperators. At most, make three pieces out of the input file
        $document = explode($this->yaml_separator,$input, 3);
        
        switch( sizeof($document) ) {
            case 0:
            case 1:
                // Empty document
                $front_matter = "";
                $content = "";
                break;
            case 2:
                # Only front matter given
                $front_matter = $document[1];
                $content = "";
                break;
            default:
                # Normal document
                $front_matter = $document[1];
                $content = $document[2];
        }
        
        # Parse YAML
		try {
			$final = Yaml::parse($front_matter);
		} catch (ParseException $e) {
			printf("Unable to parse the YAML string: %s", $e->getMessage());
		}
        
        # Store Content in Final array
        $final['content'] = $content;
        
        # Return Final array
        return $final;
    }
function FrontMatter ( $ input ) { if ( ! $ this -> startsWith ( $ input , $ this -> yaml_separator ) ) { # No front matter # Store Content in Final array $ final [ 'content' ] = $ input ; # Return Final array return $ final ; } # Explode Seperators. At most, make three pieces out of the input file $ document = explode ( $ this -> yaml_separator , $ input , 3 ) ; switch ( sizeof ( $ document ) ) { case 0 : case 1 : // Empty document $ front_matter = "" ; $ content = "" ; break ; case 2 : # Only front matter given $ front_matter = $ document [ 1 ] ; $ content = "" ; break ; default : # Normal document $ front_matter = $ document [ 1 ] ; $ content = $ document [ 2 ] ; } # Parse YAML try { $ final = Yaml :: parse ( $ front_matter ) ; } catch ( ParseException $ e ) { printf ( "Unable to parse the YAML string: %s" , $ e -> getMessage ( ) ) ; } # Store Content in Final array $ final [ 'content' ] = $ content ; # Return Final array return $ final ; }
FrontMatter method, rturns all the variables from a YAML Frontmatter input
@param string $input The input string
@return array $final returns all variables in an array
FrontMatter method rturns all the variables from a YAML Frontmatter input