Coseva\CSV::_resolveFilename PHP Method

_resolveFilename() private method

Note: Because PHP's integer type is signed and many platforms use 32bit integers, some filesystem functions may return unexpected results for files which are larger than 2GB.
See also: http://php.net/manual/en/function.realpath.php
private _resolveFilename ( &$filename, boolean $use_include_path = false ) : boolean
$use_include_path boolean whether or not to use the PHP include path. If set to true, the PHP include path will be used to look for the given filename. Only if the filename is using a relative path.
return boolean true|false to indicate whether the resolving succeeded.
    private function _resolveFilename(&$filename, $use_include_path = false)
    {
        $exists = file_exists($filename);
        // The given filename did not suffice. Let's do a deeper check.
        if (!$exists && $use_include_path && substr($filename, 0, 1) !== '/') {
            // Gather the include paths.
            $paths = explode(':', get_include_path());
            // Walk through the include paths.
            foreach ($paths as $path) {
                // Check if the file exists within this path.
                $exists = realpath($path . '/' . $filename);
                // It didn't work. Move along.
                if (!$exists) {
                    continue;
                }
                // It actually did work. Now overwrite my filename.
                $filename = $exists;
                $exists = true;
                break;
            }
        }
        return $exists && is_readable($filename);
    }