src/Service/Misc/File.php
protected function getFileContentsArray($filePath)
    {
        $filePath = realpath($filePath);

        static $filecache = array();

        if (isset($filecache[$filePath]) === true) {
            return $filecache[$filePath];
        }

        // Using \SplFixedArray to save some memory, as it can get
        // quire huge, depending on your system. 4mb is nothing here.
        if ($this->fileIsReadable($filePath) === true) {
            return $filecache[$filePath] = \SplFixedArray::fromArray(file($filePath));
        }
        // Not readable!
        return $filecache[$filePath] = new \SplFixedArray(0);
    }
protected function getFileContentsArray($filePath)
    {
        $filePath = realpath($filePath);

        static $filecache = array();

        if (isset($filecache[$filePath]) === true) {
            return $filecache[$filePath];
        }

        // Using \SplFixedArray to save some memory, as it can get
        // quire huge, depending on your system. 4mb is nothing here.
        if ($this->fileIsReadable($filePath) === true) {
            return $filecache[$filePath] = \SplFixedArray::fromArray(file($filePath));
        }
        // Not readable!
        return $filecache[$filePath] = new \SplFixedArray(0);
    }
protected function getFileContentsArray ( $ filePath ) { $ filePath = realpath ( $ filePath ) ; static $ filecache = array ( ) ; if ( isset ( $ filecache [ $ filePath ] ) === true ) { return $ filecache [ $ filePath ] ; } // Using \SplFixedArray to save some memory, as it can get // quire huge, depending on your system. 4mb is nothing here. if ( $ this -> fileIsReadable ( $ filePath ) === true ) { return $ filecache [ $ filePath ] = \ SplFixedArray :: fromArray ( file ( $ filePath ) ) ; } // Not readable! return $ filecache [ $ filePath ] = new \ SplFixedArray ( 0 ) ; }
Reads a file into an array and uses some caching.

@param string $filePath
The path to the file we want to read.

@return \SplFixedArray
The file in a \SplFixedArray.
Reads a file into an array and uses some caching .