Returns a single File object representing a file stored on B2.

@param array $options

@throws NotFoundException If no file id was provided and BucketName + FileName does not resolve to a file, a NotFoundException is thrown.

@return File
962246
public function getFile(array $options)
    {
        if (!isset($options['FileId']) && isset($options['BucketName']) && isset($options['FileName'])) {
            $options['FileId'] = $this->getFileIdFromBucketAndFileName($options['BucketName'], $options['FileName']);

            if (!$options['FileId']) {
                throw new NotFoundException();
            }
        }

        $response = $this->generateAuthenticatedClient([
            'fileId' => $options['FileId'],
        ])->request('POST', '/b2_get_file_info');

        return new File(
            $response['fileId'],
            $response['fileName'],
            $response['contentSha1'],
            $response['contentLength'],
            $response['contentType'],
            $response['fileInfo'],
            $response['bucketId'],
            $response['action'],
            $response['uploadTimestamp']
        );
    }
828461
protected function getFileSystem()
    {
        if (null === $this->filesystem) {
            /** @var FileSystemService $fileSystemService */
            $fileSystemService = $this->getServiceManager()->get(FileSystemService::SERVICE_ID);
            $this->filesystem = $fileSystemService->getFileSystem($this->getOption(self::OPTION_FILESYSTEM));
        }

        return $this->filesystem;
    }
413319
public function decode($file, array $options = [])
    {
        $image  = new Image($file);
        $binary = $image->getBinaryString();

        return $this->decodeMessage($binary, $options);
    }
961320
public function open($filename)
    {
        if (!$this->exists($filename) || false === $content = file_get_contents($filename)) {
            throw new FileNotFoundException($filename);
        }

        return $this->makeFile($filename, $content);
    }
601623
public function deleteFile(array $options)
    {
        if (!isset($options['FileName'])) {
            $file = $this->getFile($options);

            $options['FileName'] = $file->getName();
        }

        if (!isset($options['FileId']) && isset($options['BucketName']) && isset($options['FileName'])) {
            $file = $this->getFile($options);

            $options['FileId'] = $file->getId();
        }

        try {
            $this->generateAuthenticatedClient([
                'fileName' => $options['FileName'],
                'fileId'   => $options['FileId'],
            ])->request('POST', '/b2_delete_file_version');
        } catch (\Exception $e) {
            return false;
        }

        return true;
    }
1308527
public function file($fieldName, array $options = [])
    {
        $errorSuffix = null;
        $error       = $this->error($fieldName);
        $content     = parent::file($fieldName, $options);

        if ($this->getConfig('materializeCss', false) === false) {
            return $content;
        }

        $options = $this->_parseOptions($fieldName, $options);

        $options['type'] = __FUNCTION__;
        if ($error !== '') {
            $options['error'] = $error;
            $errorSuffix = 'Error';
        }

        $result = $this->_inputContainerTemplate([
            'error'       => $error,
            'content'     => $content,
            'options'     => $options,
            'errorSuffix' => $errorSuffix
        ]);

        return $result;
    }
1109530
public function getBucketMeta($bucket, $options = NULL)
    {
        $this->precheckCommon($bucket, NULL, $options, false);
        $options[self::OSS_BUCKET] = $bucket;
        $options[self::OSS_METHOD] = self::OSS_HTTP_HEAD;
        $options[self::OSS_OBJECT] = '/';
        $response = $this->auth($options);
        $result = new HeaderResult($response);
        return $result->getData();
    }
987252
public function getObject(array $options = array())
    {
        $content = $this->getContent();

        if (is_null($content)) {
            return (object)$content;
        }

        return json_decode($this->content, false);
    }
451698
protected static function getBitBucketClient(array $options = [])
    {
        if (null === static::$client || static::$client->getOptions() !== $options) {
            static::$client = new BitBucketClient($options);
        }

        return static::$client;
    }
955726
public function fromArray(array $options)
    {
        if (isset($options['Id'])) {
            Validate::isString($options['Id'], 'options[Id]');
            $this->_id = $options['Id'];
        }

        if (isset($options['State'])) {
            Validate::isInteger($options['State'], 'options[State]');
            $this->_state = $options['State'];
        }

        if (isset($options['Created'])) {
            Validate::isDateString($options['Created'], 'options[Created]');
            $this->_created = new \DateTime($options['Created']);
        }

        if (isset($options['LastModified'])) {
            Validate::isDateString(
                $options['LastModified'],
                'options[LastModified]'
            );
            $this->_lastModified = new \DateTime($options['LastModified']);
        }

        if (isset($options['Name'])) {
            Validate::isString($options['Name'], 'options[Name]');
            $this->_name = $options['Name'];
        }

        if (isset($options['BlobStorageUriForUpload'])) {
            Validate::isValidUri(
                $options['BlobStorageUriForUpload'],
                'options[BlobStorageUriForUpload]'
            );
            $this->_blobStorageUriForUpload = $options['BlobStorageUriForUpload'];
        }

        if (isset($options['Statistics'])) {
            $this->_statistics = null;
            if (is_array($options['Statistics'])) {
                $this->_statistics = IngestManifestStatistics::createFromOptions(
                    $options['Statistics']
                );
            }
        }

        if (isset($options['StorageAccountName'])) {
            Validate::isString(
                $options['StorageAccountName'],
                'options[StorageAccountName]'
            );
            $this->_storageAccountName = $options['StorageAccountName'];
        }
    }
889079
private function partitionOptions(array $options)
    {
        $options['partitionOptions'] = array_filter([
            'partitionSizeBytes' => $this->pluck('partitionSizeBytes', $options, false),
            'maxPartitions' => $this->pluck('maxPartitions', $options, false)
        ]);

        return $options;
    }
593922
public function upload($file, array $options = [])
    {
        $filename = sprintf('%s-%s', rand(100, 999), $file->getClientOriginalName());
        return Storage::putFileAs($this->uploadFolder, $file, $filename);
    }
570494
public function actionFile($id)
    {
        $model = StorageFile::find()->where(['id' => $id])->one();

        if (!$model) {
            throw new NotFoundHttpException("Unable to find the given storage file.");
        }

        return $model;
    }
511705
public static function getInstance($name = 'none', $options = array())
	{
		$filter = new InputFilter;
		$name   = strtolower($filter->clean($name, 'word'));

		if (empty(self::$instances[$name]))
		{
			$class = '\\Joomla\\Session\\Storage\\' . ucfirst($name);

			if (!class_exists($class))
			{
				$path = __DIR__ . '/storage/' . $name . '.php';

				if (file_exists($path))
				{
					require_once $path;
				}
				else
				{
					// No attempt to die gracefully here, as it tries to close the non-existing session
					exit('Unable to load session storage class: ' . $name);
				}
			}

			self::$instances[$name] = new $class($options);
		}

		return self::$instances[$name];
	}
1212651
public function file($fieldName, $options = [])
    {
        $defaults = [
            'div' => [
                'class' => 'form-group',
            ],
        ];
        $options = array_merge($defaults, $options);
        return parent::input($fieldName, $options);
    }
1270652
public static function open(array $options = [])
    {
        // get the method passed in $options else use port
        $method = array_get($options, 'method', 'post');
        $attributes['method'] = self::getMethod($method);

        $attributes['action'] = self::getAction($options);
        $attributes['accept-charset'] = array_get($options, 'charset', 'UTF-8');
        //
        //PUT and PATCH and DELETE
        //
        //if form use files
        if (isset($options['files']) || in_array('files', $options)) {
            $options['enctype'] = 'multipart/form-data';
        }

        $attributes = array_merge(
            $attributes, array_except($options, self::$reserved)
        );

        $attributes = Html::attributes($attributes);

        $token = self::token();

        return '<form'.$attributes.'>'.$token;
    }
1096870
public function uploadLargeFile(array $options)
    {
        if (substr($options['FileName'], 0, 1) === '/') {
            $options['FileName'] = ltrim($options['FileName'], '/');
        }

        //if last char of path is not a "/" then add a "/"
        if (substr($options['FilePath'], -1) != '/') {
            $options['FilePath'] = $options['FilePath'].'/';
        }

        if (!isset($options['BucketId']) && isset($options['BucketName'])) {
            $options['BucketId'] = $this->getBucketIdFromName($options['BucketName']);
        }

        if (!isset($options['FileContentType'])) {
            $options['FileContentType'] = 'b2/x-auto';
        }

        $this->authorizeAccount();

        // 1) b2_start_large_file, (returns fileId)
        $start = $this->startLargeFile($options['FileName'], $options['FileContentType'], $options['BucketId']);

        // 2) b2_get_upload_part_url for each thread uploading (takes fileId)
        $url = $this->getUploadPartUrl($start['fileId']);

        // 3) b2_upload_part for each part of the file
        $parts = $this->uploadParts($options['FilePath'].$options['FileName'], $url['uploadUrl'], $url['authorizationToken']);

        $sha1s = [];

        foreach ($parts as $part) {
            $sha1s[] = $part['contentSha1'];
        }

        // 4) b2_finish_large_file.
        return $this->finishLargeFile($start['fileId'], $sha1s);
    }