コード例 #1
0
ファイル: SoftLayer.php プロジェクト: todiadiyatmo/phpbu
 /**
  * (non-PHPDoc)
  *
  * @see    \phpbu\App\Backup\Sync::setup()
  * @param  array $config
  * @throws \phpbu\App\Backup\Sync\Exception
  */
 public function setup(array $config)
 {
     if (!class_exists('\\ObjectStorage')) {
         throw new Exception('SoftLayer SDK not loaded: use composer "softlayer/objectstorage": "dev-master" to install');
     }
     if (!Arr::isSetAndNotEmptyString($config, 'user')) {
         throw new Exception('SoftLayer user is mandatory');
     }
     if (!Arr::isSetAndNotEmptyString($config, 'secret')) {
         throw new Exception('SoftLayer password is mandatory');
     }
     if (!Arr::isSetAndNotEmptyString($config, 'container')) {
         throw new Exception('SoftLayer container name is mandatory');
     }
     if (!Arr::isSetAndNotEmptyString($config, 'host')) {
         throw new Exception('SoftLayer host is mandatory');
     }
     if (!Arr::isSetAndNotEmptyString($config, 'path')) {
         throw new Exception('SoftLayer path is mandatory');
     }
     $this->user = $config['user'];
     $this->secret = $config['secret'];
     $this->container = $config['container'];
     $this->host = $config['host'];
     $this->path = Str::withLeadingSlash(Str::withTrailingSlash(Str::replaceDatePlaceholders($config['path'])));
 }