Fetch file from storage

@param string $path
@return \Infotech\FileStorage\File\FileDescriptor|null
@throws \Infotech\FileStorage\Storage\Exception\OperationFailureException if storage failure
179892
public function get($path)
    {
        $localPath = $this->createUri($path);
        if (!file_exists($localPath)) {
            return null;
        } elseif (!is_readable($localPath)) {
            throw new Exception\OperationFailureException('File reading error.');
        } else {
            return new FileDescriptor($localPath, filesize($localPath));
        }
    }
924192
public function objectUrl($path)
    {
        if (URL::isValidUrl($path)) {
            return $path;
        }

        return Storage::disk(config('admin.upload.disk'))->url($path);
    }
92661
public function getFileUrl($key, $path = null)
	{
		if (is_null($key)) {
			return null;
		}

		$bucket = config('filesystems.disks.s3.bucket');
		$client = Storage::disk('s3')->getAdapter()->getClient();

		return $this->getRealUrl($client->getObjectUrl($bucket, $path . $key));
	}
888988
public static function getFileExtention($path)
    {

        $ext = pathinfo($path, PATHINFO_EXTENSION);

        if($ext === ''){
            $splitedPath = explode('.', $path);
            $ext = end($splitedPath);
        }

        return $ext;
    }
736624
private function loadFile(string $path)
    {
        if (!file_exists($path)) {
            throw new Exception('Configuration file "' . $path . '" is not found');
        }

        if (!is_readable($path)) {
            throw new Exception('Configuration file "' . $path . '" is not readable');
        }

        // Include file
        $content = include $path;

        if (!\is_array($content)) {
            throw new Exception("Passed file \"$path\" is not array");
        }

        return $content;
    }
371287
public function loadFrom($path)
    {
        // Avoid repeat load of broken images
        $hash = sha1($path);
        if ($this->hasFailed($hash, null)) {
            return $this;
        }

        // Handle resource
        $error = self::FAILED_UNKNOWN;
        try {
            $this->setImageResource($this->getImageManager()->make($path));
            $this->markSuccess($hash, null);
            $error = null;
        } catch (NotReadableException $ex) {
            // Handle unsupported image encoding on load (will be marked as failed)
            // Unsupported exceptions are handled without being raised as exceptions
            $error = self::FAILED_INVALID;
        } finally {
            if ($error) {
                $this->markFailed($hash, null, $error);
            }
        }

        return $this;
    }
463613
protected function loadFile($path)
    {
        $composerJson = $this->fileData($path);

        return (null === $composerJson) ? null : (array) \json_decode($composerJson, true);
    }
658127
public function fromPath($path)
    {
        $mimetype = null;

        if (static::isSupported())
        {
            if (!is_file($path)) {
                throw new \RuntimeException('File not found at '.$path);
            }

            if (!is_readable($path)) {
                throw new \RuntimeException('File not readable at '.$path);
            }

            $mimetype = $this->_getMimetype(strtolower(pathinfo($path, PATHINFO_EXTENSION)));
        }

        return $mimetype;
    }
834183
public function get( string $path, bool $lock = false )
	{
		if( $this->isFile( $path ) )
		{
			return $lock ? $this->sharedGet( $path ) : file_get_contents( $path );
		}
		throw new NotFoundFileException($path, "File does not exist at path '{$path}'");
	}
89111
protected function loadFromFile($path)
    {
        if (!file_exists($path)) {
            throw new \Exception(sprintf('Map file "%s" does not exist.', $path));
        }

        $map = require($path);
        if (!is_array($map)
            || !is_array($map[Settings::ALPHABET_CYR])
            || !is_array($map[Settings::ALPHABET_LAT])
        ) {
            throw new \Exception(sprintf(
                'Map file "%s" is not valid, should return an array with %s and %s subarrays.',
                $path,
                Settings::ALPHABET_CYR,
                Settings::ALPHABET_LAT
            ));
        }

        return $map;
    }
833233
public static function getContent($path)
    {
        if (is_dir($path)) {
            $files = array_diff(scandir($path), array('.', '..'));

            return $files;
        } else {
            throw new \Exception(sprintf('Incorrect path "%s" name in %s at line %s', $path, __FILE__, __LINE__));
        }
    }
460768
public function loadFile($path)
    {
        if (!is_string($path)) {
            throw new InvalidArgumentException(
                'File must be a string'
            );
        }

        if (!file_exists($path)) {
            throw new InvalidArgumentException(
                sprintf('File "%s" does not exist', $path)
            );
        }

        $ext = pathinfo($path, PATHINFO_EXTENSION);
        switch ($ext) {
            case 'php':
                return $this->loadPhpFile($path);

            case 'json':
                return $this->loadJsonFile($path);

            case 'ini':
                return $this->loadIniFile($path);

            case 'yml':
            case 'yaml':
                return $this->loadYamlFile($path);
        }

        $validConfigExts = [ 'ini', 'json', 'php', 'yml' ];
        throw new InvalidArgumentException(sprintf(
            'Unsupported file format for "%s"; must be one of "%s"',
            $path,
            implode('", "', $validConfigExts)
        ));
    }
631871
public function download($path)
    {
        $this->setupRequest([
            'path' => $this->normalizePath($path),
        ]);

        $this->apiEndpoint = 'files/download';

        $this->content = null;

        $response = $this->doDropboxApiContentRequest();

        return StreamWrapper::getResource($response->getBody());
    }
577920
static function GetContents($path)
    {
        if (!self::Exists($path))
            throw new Exceptions\PathNotFoundException("File $path doesn't exist");
        
        if (!self::IsReadable($path))
            throw new Exceptions\PathNoAccessException("File $path cannot be read");
        
        return file_get_contents($path);
    }
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;
    }
797870
public static function createFromPath($path)
    {
        if (!file_exists($path)) {
            throw new Exception\FactoryException(sprintf('Unable to open file %s', $path));
        }
        $file = new \SplFileInfo($path);
        return static::createFromSplFileInfo($file);
    }
468220
public function getRequire( string $path )
	{
		if( $this->isFile( $path ) )
		{
			return $this->callback(static function($file) {
				/** @noinspection PhpIncludeInspection */
				return require $file;
			}, $path);
		}
		throw new NotFoundFileException($path,"File does not exist at path '{$path}'" );
	}