yii\mongodb\file\StreamWrapper::prepareDownload PHP Метод

prepareDownload() приватный Метод

Prepares Download instance for the read operations.
private prepareDownload ( ) : boolean
Результат boolean success.
    private function prepareDownload()
    {
        $contextOptions = $this->getContextOptions();
        if (isset($contextOptions[$this->protocol]['download'])) {
            $download = $contextOptions[$this->protocol]['download'];
            if (!$download instanceof Download) {
                throw new InvalidConfigException('"download" context option should be an instance of "' . Download::className() . '"');
            }
            $this->download = $download;
            return true;
        }
        $collection = $this->fetchCollection();
        if (empty($this->queryParams)) {
            return false;
        }
        $file = $collection->findOne($this->queryParams);
        if (empty($file)) {
            throw new InvalidConfigException('Requested file does not exits.');
        }
        $this->download = $file['file'];
        return true;
    }