Set disk for storage.

@param string $disk Disks defined in `config/filesystems.php`.

@throws \Exception

@return $this
15365
public function disk($disk)
    {
        try {
            $this->storage = Storage::disk($disk);
        } catch (\Exception $exception) {
            if (!array_key_exists($disk, config('filesystems.disks'))) {
                admin_error(
                    'Config error.',
                    "Disk [$disk] not configured, please add a disk config in `config/filesystems.php`."
                );

                return $this;
            }

            throw $exception;
        }

        return $this;
    }
661242
public function setObject($object)
    {
        if (!is_object($object) && (null !== $object)) {
            require_once 'Zend/Server/Exception.php';
            throw new Zend_Server_Exception('Invalid object passed to ' . __CLASS__ . '::' . __METHOD__);
        }
        $this->_object = $object;
        return $this;
    }
676117
public function setRegion($region)
	{
		if ( ! $region instanceof Region)
		{
			$region = new Region($region);
		}
		$this->region = $region;

		return $this;
	}
1182299
public function rmdir($directory) {
        if (false === @ftp_rmdir($this->getConnection(), $directory)) {
            throw $this->newFTPException(sprintf("rmdir %s failed", $directory));
        }
        return $this;
    }
419584
protected function setCookie($cookie)
    {
        $this->cookie = trim(base64_encode(mcrypt_encrypt(
            MCRYPT_RIJNDAEL_256, '7e2d20j23a21db9f', $cookie, MCRYPT_MODE_ECB, $this->config->getSecret()
        )));

        setcookie($this->config->getCookieName(), $this->cookie, (time() + 60 * 5), null, null, null, true);

        return $this;
    }
1050649
public function setStorage($storageName)
    {
        Assertion::keyExists($this->availableStorages, $storageName, "Storage '{$storageName}' not available.");
        $this->enabledStorage = $storageName;

        return $this;
    }
361657
public function setBackup($value)
    {
        parent::setBackup($value);
        $this->storage->setBackup($value);

        return $this;
    }
782567
public function setPGTStorage($storage)
    {
    	// Sequence validation
        $this->ensureIsProxy();

        // check that the storage has not already been set
        if ( is_object($this->_pgt_storage) ) {
            phpCAS::error('PGT storage already defined');
        }

        // check to make sure a valid storage object was specified
        if ( !($storage instanceof CAS_PGTStorage_AbstractStorage) )
            throw new CAS_TypeMismatchException($storage, '$storage', 'CAS_PGTStorage_AbstractStorage object');

        // store the PGTStorage object
        $this->_pgt_storage = $storage;
    }
241720
public function setting($key = null) : Storage
    {
        $this->getStorage()->clearKey();
        $storage = $this->getStorage()->addKey(self::SETTING);
        if ($key === null) {
            return $this->getStorage()->get();
        }
        return $storage->addKey($key);
    }
507839
public function setAccessTokenStorage(AccessTokenInterface $storage)
    {
        $storage->setServer($this);
        $this->accessTokenStorage = $storage;

        return $this;
    }
9714
public function setDiskQuote(int $diskQuote)
    {
        $this->diskQuote = $diskQuote;

        $this->hostConfig = array_merge($this->hostConfig, ['DiskQuota ' => $diskQuote]);

        return $this;
    }
1251714
public function setCaching($caching) {
        if(is_object($caching)) {
            $this->cacheObj = $caching;
            $this->cacheEnabled = true;
        }
        return $this;
    }
575414
public function setDictionaryFromFile( $path ) {
    if ( file_exists( $path ) ) {
      $dict = include $path;
      if( is_array($dict) ) {
        $this->dictionary = $dict;
        $this->fillDictionaryWords();
        return $this;
      }
      throw new \Exception('The file content must be an array!');
    }
    throw new \Exception('File not found in ' . $path );
  }
551650
public function set($domain, FilesystemInterface $filesystem)
    {
        if (!preg_match('/^[-_a-zA-Z0-9]+$/', $domain)) {
            throw new \InvalidArgumentException(sprintf(
                'The specified domain "%s" is not a valid domain.',
                $domain
            ));
        }

        $this->filesystems[$domain] = $filesystem;
    }
771043
protected function assertValidDisk($disk)
    {
        $translator = $this->translator();

        if ($disk === null) {
            $message = $translator->translate(
                'Default filesystem [{{ defaultFilesystemConnection }}] is not defined',
                [
                    '{{ defaultFilesystemConnection }}' => 'config.filesystem.default_connection'
                ]
            );

            throw new InvalidArgumentException($message, 400);
        }

        if (!is_string($disk)) {
            $actualType = is_object($disk) ? get_class($disk) : gettype($disk);
            $message = $translator->translate(
                '{{ parameter }} must be a {{ expectedType }}, received {{ actualType }}',
                [
                    '{{ parameter }}'    => '"disk"',
                    '{{ expectedType }}' => 'string',
                    '{{ actualType }}'   => $actualType,
                ]
            );

            throw new InvalidArgumentException($message, 400);
        }

        if (!isset($this->filesystems[$disk])) {
            $message = $translator->translate('Filesystem identifier "{{ fsIdent }}" is not defined.', [
                '{{ fsIdent }}' => $disk
            ]);

            throw new InvalidArgumentException($message, 400);
        }
    }
267880
public function setFields($fields): self
    {
        if (!is_iterable($fields)) {
            throw new Exception(sprintf('%s() expects argument passed to be iterable, %s given', __METHOD__, gettype($fields)));
        }

        $this->fields = [];
        foreach ($fields as $field) {
            $this->addField(...$field);
        }

        return $this;
    }
850039
public function move($disk)
    {
        if (!in_array($disk, array_keys(config('filesystems.disks')))) {
            throw new \InvalidArgumentException("Filesystem \"{$disk}\" is not defined.");
        }

        if ($this->disk !== $disk) {
            // Move file
            Storage::disk($disk)->put($this->path, $this->storage->get($this->path));

            // Remove old files
            $this->deleteFiles();

            $this->disk = $disk;
            $this->save();
        }
    }