src/MarkdownIt/RulesBlock/StateBlock.php
public function getLines($begin, $end, $indent, $keepLastLF)
    {
        
        $line = $begin;

        if ($begin >= $end) {
            return '';
        }

        $queue =array_fill(0, $end - $begin, '');

        for ($i = 0; $line < $end; $line++, $i++) {
            $lineIndent = 0;
            $lineStart = $first = $this->bMarks[$line];

            if ($line + 1 < $end || $keepLastLF) {
                // No need for bounds check because we have fake entry on tail.
                $last = $this->eMarks[$line] + 1;
            } else {
                $last = $this->eMarks[$line];
            }

            while ($first < $last && $lineIndent < $indent) {
                $ch = $this->src[$first];

                if ($this->md->utils->isSpace($ch)) {
                    if ($ch === "\t") {
                        $lineIndent += 4 - ($lineIndent + $this->bsCount[$line]) % 4;
                    } else {
                        $lineIndent++;
                    }
                } else if ($first - $lineStart < $this->tShift[$line]) {
                    // patched tShift masked characters to look like spaces (blockquotes, list markers)
                    $lineIndent++;
                } else {
                    break;
                }

                $first++;
            }

            if ($lineIndent > $indent) {
                // partially expanding tabs in code blocks, e.g '\t\tfoobar'
                // with indent=2 becomes '  \tfoobar'
                $queue[$i] = str_repeat(' ', $lineIndent - $indent) . substr($this->src, $first, $last-$first);
            } else {
                $queue[$i] = substr($this->src, $first, $last-$first);
            }
        }

        return join('',$queue);
    }
public function getLines($begin, $end, $indent, $keepLastLF)
    {
        
        $line = $begin;

        if ($begin >= $end) {
            return '';
        }

        $queue =array_fill(0, $end - $begin, '');

        for ($i = 0; $line < $end; $line++, $i++) {
            $lineIndent = 0;
            $lineStart = $first = $this->bMarks[$line];

            if ($line + 1 < $end || $keepLastLF) {
                // No need for bounds check because we have fake entry on tail.
                $last = $this->eMarks[$line] + 1;
            } else {
                $last = $this->eMarks[$line];
            }

            while ($first < $last && $lineIndent < $indent) {
                $ch = $this->src[$first];

                if ($this->md->utils->isSpace($ch)) {
                    if ($ch === "\t") {
                        $lineIndent += 4 - ($lineIndent + $this->bsCount[$line]) % 4;
                    } else {
                        $lineIndent++;
                    }
                } else if ($first - $lineStart < $this->tShift[$line]) {
                    // patched tShift masked characters to look like spaces (blockquotes, list markers)
                    $lineIndent++;
                } else {
                    break;
                }

                $first++;
            }

            if ($lineIndent > $indent) {
                // partially expanding tabs in code blocks, e.g '\t\tfoobar'
                // with indent=2 becomes '  \tfoobar'
                $queue[$i] = str_repeat(' ', $lineIndent - $indent) . substr($this->src, $first, $last-$first);
            } else {
                $queue[$i] = substr($this->src, $first, $last-$first);
            }
        }

        return join('',$queue);
    }
public function getLines ( $ begin , $ end , $ indent , $ keepLastLF ) { $ line = $ begin ; if ( $ begin >= $ end ) { return '' ; } $ queue = array_fill ( 0 , $ end - $ begin , '' ) ; for ( $ i = 0 ; $ line < $ end ; $ line ++ , $ i ++ ) { $ lineIndent = 0 ; $ lineStart = $ first = $ this -> bMarks [ $ line ] ; if ( $ line + 1 < $ end || $ keepLastLF ) { // No need for bounds check because we have fake entry on tail. $ last = $ this -> eMarks [ $ line ] + 1 ; } else { $ last = $ this -> eMarks [ $ line ] ; } while ( $ first < $ last && $ lineIndent < $ indent ) { $ ch = $ this -> src [ $ first ] ; if ( $ this -> md -> utils -> isSpace ( $ ch ) ) { if ( $ ch === "\t" ) { $ lineIndent += 4 - ( $ lineIndent + $ this -> bsCount [ $ line ] ) % 4 ; } else { $ lineIndent ++ ; } } else if ( $ first - $ lineStart < $ this -> tShift [ $ line ] ) { // patched tShift masked characters to look like spaces (blockquotes, list markers) $ lineIndent ++ ; } else { break ; } $ first ++ ; } if ( $ lineIndent > $ indent ) { // partially expanding tabs in code blocks, e.g '\t\tfoobar' // with indent=2 becomes '  \tfoobar' $ queue [ $ i ] = str_repeat ( ' ' , $ lineIndent - $ indent ) . substr ( $ this -> src , $ first , $ last - $ first ) ; } else { $ queue [ $ i ] = substr ( $ this -> src , $ first , $ last - $ first ) ; } } return join ( '' , $ queue ) ; }
cut lines range from source.
@param integer $begin
@param integer $end
@param integer $indent
@param boolean $keepLastLF
@return string
cut lines range from source .