public function parseLines()
    {
        $text = [];

        while (($line = $this->nextLine()) !== false) {
            $line = rtrim($line);

            // Skip empty lines
            if ($line == "") {
                $text[] = null;
                continue;
            }

            // Look at start of line to detect valid blocktypes
            $blockTypes = [];
            $marker = $line[0];
            if (isset($this->blockTypes[$marker])) {
                foreach ($this->blockTypes[$marker] as $blockType) {
                    $blockTypes[] = $blockType;
                }
            }

            // Check if line is matching a detected blocktype
            foreach ($blockTypes as $blockType) {
                if ($this->{"block".$blockType}($line)) {
                    continue;
                }
            }
        }

        $text = implode("\n", $this->lines);

        return [
            "text" => $text,
            "frontmatter" => $this->frontmatter,
        ];
    }
public function parseLines()
    {
        $text = [];

        while (($line = $this->nextLine()) !== false) {
            $line = rtrim($line);

            // Skip empty lines
            if ($line == "") {
                $text[] = null;
                continue;
            }

            // Look at start of line to detect valid blocktypes
            $blockTypes = [];
            $marker = $line[0];
            if (isset($this->blockTypes[$marker])) {
                foreach ($this->blockTypes[$marker] as $blockType) {
                    $blockTypes[] = $blockType;
                }
            }

            // Check if line is matching a detected blocktype
            foreach ($blockTypes as $blockType) {
                if ($this->{"block".$blockType}($line)) {
                    continue;
                }
            }
        }

        $text = implode("\n", $this->lines);

        return [
            "text" => $text,
            "frontmatter" => $this->frontmatter,
        ];
    }
public function parseLines ( ) { $ text = [ ] ; while ( ( $ line = $ this -> nextLine ( ) ) !== false ) { $ line = rtrim ( $ line ) ; // Skip empty lines if ( $ line == "" ) { $ text [ ] = null ; continue ; } // Look at start of line to detect valid blocktypes $ blockTypes = [ ] ; $ marker = $ line [ 0 ] ; if ( isset ( $ this -> blockTypes [ $ marker ] ) ) { foreach ( $ this -> blockTypes [ $ marker ] as $ blockType ) { $ blockTypes [ ] = $ blockType ; } } // Check if line is matching a detected blocktype foreach ( $ blockTypes as $ blockType ) { if ( $ this -> { "block" . $ blockType } ( $ line ) ) { continue ; } } } $ text = implode ( "\n" , $ this -> lines ) ; return [ "text" => $ text , "frontmatter" => $ this -> frontmatter , ] ; }
Parse each line and look into it to see whats need to be done.

@return array with the resulting text and optional additional items.
Parse each line and look into it to see whats need to be done .