當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Google_Config::setAuthClass方法代碼示例

本文整理匯總了PHP中Google_Config::setAuthClass方法的典型用法代碼示例。如果您正苦於以下問題:PHP Google_Config::setAuthClass方法的具體用法?PHP Google_Config::setAuthClass怎麽用?PHP Google_Config::setAuthClass使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Google_Config的用法示例。


在下文中一共展示了Google_Config::setAuthClass方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: make

 /**
  * @param string $name
  * @return \League\Flysystem\AdapterInterface
  * @throws \RuntimeException
  */
 public static function make($name)
 {
     $connections = Config::get('storage.connections');
     if (!isset($connections[$name])) {
         throw new \RuntimeException(sprintf('The storage connection %d does not exist.', $name));
     }
     $connection = $connections[$name];
     $connection['adapter'] = strtoupper($connection['adapter']);
     switch ($connection['adapter']) {
         case 'LOCAL':
             return new Local($connection['root_path'], $connection['public_url_base']);
         case 'RACKSPACE':
             $service = isset($connection['service']) ? Config::get($connection['service']) : Config::get('services.rackspace');
             $client = new Rackspace($service['api_endpoint'], array('username' => $service['username'], 'tenantName' => $service['tenant_name'], 'apiKey' => $service['api_key']));
             $store = $client->objectStoreService($connection['store'], $connection['region']);
             $container = $store->getContainer($connection['container']);
             return new RackspaceAdapter($container);
         case 'AWS':
             $service = isset($connection['service']) ? Config::get($connection['service']) : Config::get('services.aws');
             $client = S3Client::factory(array('credentials' => array('key' => $service['access_key'], 'secret' => $service['secret_key']), 'region' => $service['region'], 'version' => 'latest'));
             return new AwsS3Adapter($client, $connection['bucket']);
         case 'GCLOUD':
             $service = isset($connection['service']) ? Config::get($connection['service']) : Config::get('services.google_cloud');
             $credentials = new \Google_Auth_AssertionCredentials($service['service_account'], [\Google_Service_Storage::DEVSTORAGE_FULL_CONTROL], file_get_contents($service['key_file']), $service['secret']);
             $config = new \Google_Config();
             $config->setAuthClass(GoogleAuthOAuth2::class);
             $client = new \Google_Client($config);
             $client->setAssertionCredentials($credentials);
             $client->setDeveloperKey($service['developer_key']);
             $service = new \Google_Service_Storage($client);
             return new GoogleStorageAdapter($service, $connection['bucket']);
     }
     throw new \RuntimeException(sprintf('The storage adapter %s is invalid.', $connection['adapter']));
 }
開發者ID:Superbalist,項目名稱:laravel4-storage,代碼行數:39,代碼來源:StorageAdapterFactory.php

示例2: setAuth

 /**
  * Set the authenticator object
  * @param Google_Auth_Abstract $auth
  */
 public function setAuth(Google_Auth_Abstract $auth)
 {
     $this->config->setAuthClass(get_class($auth));
     $this->auth = $auth;
 }
開發者ID:hzhou9,項目名稱:coupon_deal,代碼行數:9,代碼來源:Client.php


注:本文中的Google_Config::setAuthClass方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。