@param $path

@throws \Box\Spout\Common\Exception\IOException
@throws \Box\Spout\Common\Exception\UnsupportedTypeException

@return \Box\Spout\Reader\ReaderInterface
487602
private function reader($path)
    {
        $reader = ReaderFactory::create($this->getType($path));
        $this->setOptions($reader);
        /* @var \Box\Spout\Reader\ReaderInterface $reader */
        $reader->open($path);

        return $reader;
    }
665643
protected function prepare($path)
    {
        foreach ($this->paths as $type => $pathValue) {
            if ($pathValue instanceof pathmanager\FallbackInterface) {
                $pathValue = $pathValue->resolve('');
            }

            $path = str_replace('{{'.$type.'_dir}}', $pathValue, $path);
        }

        return $path;
    }
1284178
public function load(string $path): FileSettingsProvider
    {
        foreach ($this->selectClasses($path, SettingsInterface::class) as $settingsClass) {
            assert($this->checkDoNotHaveRequiredParametersOnCreate($settingsClass));
            /** @var SettingsInterface $settings */
            $settings = new $settingsClass();
            $this->register($settings);
        }

        return $this;
    }
586899
public function setPath($path) {
        if (!is_string($path)) throw new IllegalTypeException('Illegal type of parameter $path: '.gettype($path));
        if (!strlen($path))    throw new InvalidArgumentException('Invalid argument $path: '.$path);

        $this->path = $path;
        return $this;
    }
1290045
protected function getLoader(string $path): LoaderInterface
    {
        if (null === $this->loaderClass) {
            throw new RuntimeException('You must implement '.__METHOD__.' or pass the loader class to the constructor');
        }

        return new $this->loaderClass($path);
    }
1369037
public function reads( $path )
	{
		try {
			$content = $this->fs->get( $path );
		} catch( \Exception $e ) {
			throw new Exception( $e->getMessage(), 0, $e );
		}

		if( ( $stream = tmpfile() ) === false ) {
			throw new Exception( 'Couldn\'t create temporary file' );
		}

		if( fwrite( $stream, $content ) === false ) {
			throw new Exception( 'Couldn\'t write to temporary file' );
		}

		if( rewind( $stream ) === false ) {
			throw new Exception( 'Couldn\'t rewind temporary file' );
		}

		return $stream;
	}
1017110
private function createReadmesInGeneratedClientRoot($path)
    {
        if ($this->pathIsGapic($path)) {
            $questionText = sprintf('%s ' . PHP_EOL . 'Create README.md?', $path);
            $q = $this->confirm($questionText);
            $create = $this->askQuestion($q);
            if ($create) {
                $file = $path .'/README.md';
                $content = file_get_contents($this->templatesPath .'/'. self::README_GEN_CLIENT_TPL);

                $content = str_replace('{notice}', file_get_contents(
                    $this->templatesPath .'/'. sprintf(self::GRPC_NOTICE_TPL, $this->info['type'])
                ), $content);
                $content = str_replace('{display}', $this->info['display'], $content);
                $content = str_replace('{version}', $this->getVersionFromPath($path), $content);

                file_put_contents($file, $content);
            }
            return;
        }

        $files = $this->scanDirectory($path);
        foreach ($files as $file) {
            $file = $path .'/'. $file;
            if (is_dir($file)) {
                $this->createReadmesInGeneratedClientRoot($file);
            }
        }
    }
281505
public function readStream($path)
    {
        $response = $this->readObject($path);

        if ($response !== false) {
            $response['stream'] = $response['contents']->detach();
            unset($response['contents']);
        }

        return $response;
    }
772376
public function readStream($path)
    {
        [$prefix, $path] = $this->getPrefixAndPath($path);

        return $this->getFilesystem($prefix)->readStream($path);
    }
1054542
public function setFile($path)
    {
        if (empty($path) || !is_readable($path)) {
            /**
             * @see Zend_Auth_Adapter_Http_Resolver_Exception
             */
            require_once 'Zend/Auth/Adapter/Http/Resolver/Exception.php';
            throw new Zend_Auth_Adapter_Http_Resolver_Exception('Path not readable: ' . $path);
        }
        $this->_file = $path;

        return $this;
    }
352353
private function loadFromPath(string $path): self
    {
        switch ($this->extension) {
            case self::FORMAT_JPEG:
                $this->createFromJpeg($path);
                break;
            case self::FORMAT_PNG:
                $this->createFromPng($path);
                break;
            case self::FORMAT_GIF:
                $this->createFromGif($path);
                break;
            case self::FORMAT_WD_IMAGE:
                $this->createFromEncrypted($path);
                break;
            default:
                throw new ImageException('This image format is not supported!');
        }
        return $this;
    }
1140595
public function save($path)
    {
        if ($this->error) {
            throw new Exception($this->message, $this->error);
        }
        $fp = @fopen($path, 'w');
        if ($fp === false) {
            throw new Exception('Failed to save the content', 500);
        }
        fwrite($fp, $this->data);
        fclose($fp);
        return $this;
    }
508437
public function readStream(string $path)
    {
        $path = $this->normalizePath($path);
        $this->assertPresent($path);

        return $this->getAdapter()->readStream($path);
    }
14754
protected function fromFileType($path)
    {
        switch( Filesystem::getExtension($path) )
        {
            case 'png' : return imagecreatefrompng($path);
            case 'gif' : return imagecreatefromgif($path);
            case 'jpg' :
            case 'jpeg':
            default    : return imagecreatefromjpeg($path);
        }
    }
351594
public function create($path)
	{
		// If native FTP support is enabled let's use it...
		if (FTP_NATIVE)
		{
			// Turn passive mode on
			if (@ftp_pasv($this->conn, true) === false)
			{
				throw new FilesystemException(__METHOD__ . ': Unable to use passive mode.');
			}

			$buffer = fopen('buffer://tmp', 'r');

			if (@ftp_fput($this->conn, $path, $buffer, FTP_ASCII) === false)
			{
				fclose($buffer);

				throw new FilesystemException(__METHOD__ . 'Bad response.');
			}

			fclose($buffer);

			return true;
		}

		// Start passive mode
		if (!$this->_passive())
		{
			throw new FilesystemException(__METHOD__ . ': Unable to use passive mode.');
		}

		if (!$this->_putCmd('STOR ' . $path, array(150, 125)))
		{
			@ fclose($this->dataconn);

			throw new FilesystemException(
				sprintf('%1$s: Bad response.  Server response: %2$s [Expected: 150 or 125].  Path sent: %3$s', __METHOD__, $this->response, $path)
			);
		}

		// To create a zero byte upload close the data port connection
		fclose($this->dataconn);

		if (!$this->_verifyResponse(226))
		{
			throw new FilesystemException(
				sprintf('%1$s: Transfer failed.  Server response: %2$s [Expected: 226].  Path sent: %3$s', __METHOD__, $this->response, $path)
			);
		}

		return true;
	}
407530
protected function createCsvReader($path)
    {
        $reader = CsvReader::createFromPath($path);
        $options = $this->getFormatOptionsFromPost();

        if ($options['delimiter'] !== null) {
            $reader->setDelimiter($options['delimiter']);
        }

        if ($options['enclosure'] !== null) {
            $reader->setEnclosure($options['enclosure']);
        }

        if ($options['escape'] !== null) {
            $reader->setEscape($options['escape']);
        }

        if (
            $options['encoding'] !== null &&
            $reader->isActiveStreamFilter()
        ) {
            $reader->appendStreamFilter(sprintf(
                '%s%s:%s',
                TranscodeFilter::FILTER_NAME,
                strtolower($options['encoding']),
                'utf-8'
            ));
        }

        return $reader;
    }
721618
protected function openStream(/*# string */ $path)
    {
        if (is_string($path)) {
            if (false !== strpos($path, '://')) {
                $path = 'file://' . $path;
            }
            return fopen($path, 'a');
        }
        return $path;
    }