当前位置: 首页>>代码示例>>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;未经允许,请勿转载。