Box\Spout\Reader\AbstractReader::open PHP Method

open() public method

Prepares the reader to read the given file. It also makes sure that the file exists and is readable.
public open ( string $filePath ) : void
$filePath string Path of the file to be read
return void
    public function open($filePath)
    {
        if ($this->isStreamWrapper($filePath) && (!$this->doesSupportStreamWrapper() || !$this->isSupportedStreamWrapper($filePath))) {
            throw new IOException("Could not open {$filePath} for reading! Stream wrapper used is not supported for this type of file.");
        }
        if (!$this->isPhpStream($filePath)) {
            // we skip the checks if the provided file path points to a PHP stream
            if (!$this->globalFunctionsHelper->file_exists($filePath)) {
                throw new IOException("Could not open {$filePath} for reading! File does not exist.");
            } else {
                if (!$this->globalFunctionsHelper->is_readable($filePath)) {
                    throw new IOException("Could not open {$filePath} for reading! File is not readable.");
                }
            }
        }
        try {
            $fileRealPath = $this->getFileRealPath($filePath);
            $this->openReader($fileRealPath);
            $this->isStreamOpened = true;
        } catch (\Exception $exception) {
            throw new IOException("Could not open {$filePath} for reading! ({$exception->getMessage()})");
        }
    }