src/DlcBase/Code/Reflection/Closure.php
public function getContents($initialIdent = 4, $trimFirstAndLastLineBreak = true)
    {
        $file      = explode(PHP_EOL, file_get_contents($this->getFileName()));
        $startLine = $this->getStartLine();
        $endLine   = $this->getEndLine()-1;
        $contents  = PHP_EOL;
        $subStrStart = false;

        while ($startLine<$endLine) {
            $line = $file[$startLine];

            if (!$subStrStart) {
                $numberOfWhiteSpace = strspn($line, ' ');
                $subStrStart        = $numberOfWhiteSpace - $initialIdent;
            }

            $contents .= substr(rtrim($line), $subStrStart) . PHP_EOL;

            $startLine++;
        }

        if ($trimFirstAndLastLineBreak) {
            $contents = ltrim(rtrim($contents, PHP_EOL), PHP_EOL);
        }

        return $contents;
    }
public function getContents($initialIdent = 4, $trimFirstAndLastLineBreak = true)
    {
        $file      = explode(PHP_EOL, file_get_contents($this->getFileName()));
        $startLine = $this->getStartLine();
        $endLine   = $this->getEndLine()-1;
        $contents  = PHP_EOL;
        $subStrStart = false;

        while ($startLine<$endLine) {
            $line = $file[$startLine];

            if (!$subStrStart) {
                $numberOfWhiteSpace = strspn($line, ' ');
                $subStrStart        = $numberOfWhiteSpace - $initialIdent;
            }

            $contents .= substr(rtrim($line), $subStrStart) . PHP_EOL;

            $startLine++;
        }

        if ($trimFirstAndLastLineBreak) {
            $contents = ltrim(rtrim($contents, PHP_EOL), PHP_EOL);
        }

        return $contents;
    }
public function getContents ( $ initialIdent = 4 , $ trimFirstAndLastLineBreak = true ) { $ file = explode ( PHP_EOL , file_get_contents ( $ this -> getFileName ( ) ) ) ; $ startLine = $ this -> getStartLine ( ) ; $ endLine = $ this -> getEndLine ( ) - 1 ; $ contents = PHP_EOL ; $ subStrStart = false ; while ( $ startLine < $ endLine ) { $ line = $ file [ $ startLine ] ; if ( ! $ subStrStart ) { $ numberOfWhiteSpace = strspn ( $ line , ' ' ) ; $ subStrStart = $ numberOfWhiteSpace - $ initialIdent ; } $ contents .= substr ( rtrim ( $ line ) , $ subStrStart ) . PHP_EOL ; $ startLine ++ ; } if ( $ trimFirstAndLastLineBreak ) { $ contents = ltrim ( rtrim ( $ contents , PHP_EOL ) , PHP_EOL ) ; } return $ contents ; }
Get contents of closure

@return string
Get contents of closure