private function extractFrontMatter($text, $startToken, $stopToken)
    {
        $tokenLength = strlen($startToken);

        $start = strpos($text, $startToken);
        // Is a valid start?
        if ($start !== false && $start !== 0) {
            if ($text[$start - 1] !== "\n") {
                $start = false;
            }
        }

        $frontmatter = null;
        if ($start !== false) {
            $stop = strpos($text, $stopToken, $tokenLength - 1);

            if ($stop !== false && $text[$stop - 1] === "\n") {
                $length = $stop - ($start + $tokenLength);

                $frontmatter = substr($text, $start + $tokenLength, $length);
                $textStart = substr($text, 0, $start);
                $text = $textStart . substr($text, $stop + $tokenLength);
            }
        }

        return [$text, $frontmatter];
    }
private function extractFrontMatter($text, $startToken, $stopToken)
    {
        $tokenLength = strlen($startToken);

        $start = strpos($text, $startToken);
        // Is a valid start?
        if ($start !== false && $start !== 0) {
            if ($text[$start - 1] !== "\n") {
                $start = false;
            }
        }

        $frontmatter = null;
        if ($start !== false) {
            $stop = strpos($text, $stopToken, $tokenLength - 1);

            if ($stop !== false && $text[$stop - 1] === "\n") {
                $length = $stop - ($start + $tokenLength);

                $frontmatter = substr($text, $start + $tokenLength, $length);
                $textStart = substr($text, 0, $start);
                $text = $textStart . substr($text, $stop + $tokenLength);
            }
        }

        return [$text, $frontmatter];
    }
private function extractFrontMatter ( $ text , $ startToken , $ stopToken ) { $ tokenLength = strlen ( $ startToken ) ; $ start = strpos ( $ text , $ startToken ) ; // Is a valid start? if ( $ start !== false && $ start !== 0 ) { if ( $ text [ $ start - 1 ] !== "\n" ) { $ start = false ; } } $ frontmatter = null ; if ( $ start !== false ) { $ stop = strpos ( $ text , $ stopToken , $ tokenLength - 1 ) ; if ( $ stop !== false && $ text [ $ stop - 1 ] === "\n" ) { $ length = $ stop - ( $ start + $ tokenLength ) ; $ frontmatter = substr ( $ text , $ start + $ tokenLength , $ length ) ; $ textStart = substr ( $ text , 0 , $ start ) ; $ text = $ textStart . substr ( $ text , $ stop + $ tokenLength ) ; } } return [ $ text , $ frontmatter ] ; }
Extract front matter from text.

@deprecated since 1.2, replaced with filter\Frontmatter.

@param string $text       the text to be parsed.
@param string $startToken the start token.
@param string $stopToken  the stop token.

@return array with the formatted text and the front matter.
Extract front matter from text .