src/Service/Misc/File.php
public function readFile($filePath, $readFrom = 0, $readTo = 0)
    {
        $result = '';

        // Read the file into our cache array.
        $content = $this->getFileContentsArray($filePath);
        if ($readFrom < 0) {
             $readFrom = 0;
        }

        if ($readTo < 0) {
            $readTo = 0;
        }

        $countContent = count($content);

        if ($countContent === 0) {
            return $result;
        }

        // Do we have enough lines in there?
        if ($countContent <= $readTo) {
            $readTo = $countContent - 1;
        }

        for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) {
            $result .= $content[$currentLineNo];
        }


        return $result;
    }
public function readFile($filePath, $readFrom = 0, $readTo = 0)
    {
        $result = '';

        // Read the file into our cache array.
        $content = $this->getFileContentsArray($filePath);
        if ($readFrom < 0) {
             $readFrom = 0;
        }

        if ($readTo < 0) {
            $readTo = 0;
        }

        $countContent = count($content);

        if ($countContent === 0) {
            return $result;
        }

        // Do we have enough lines in there?
        if ($countContent <= $readTo) {
            $readTo = $countContent - 1;
        }

        for ($currentLineNo = $readFrom; $currentLineNo <= $readTo; ++$currentLineNo) {
            $result .= $content[$currentLineNo];
        }


        return $result;
    }
public function readFile ( $ filePath , $ readFrom = 0 , $ readTo = 0 ) { $ result = '' ; // Read the file into our cache array. $ content = $ this -> getFileContentsArray ( $ filePath ) ; if ( $ readFrom < 0 ) { $ readFrom = 0 ; } if ( $ readTo < 0 ) { $ readTo = 0 ; } $ countContent = count ( $ content ) ; if ( $ countContent === 0 ) { return $ result ; } // Do we have enough lines in there? if ( $ countContent <= $ readTo ) { $ readTo = $ countContent - 1 ; } for ( $ currentLineNo = $ readFrom ; $ currentLineNo <= $ readTo ; ++ $ currentLineNo ) { $ result .= $ content [ $ currentLineNo ] ; } return $ result ; }
Simply read a file into a string.

@param string $filePath
@param int $readFrom
@param int $readTo

@return string
The content of the file, between the $from and $to.
Simply read a file into a string .