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


PHP Google_Config::setDeveloperKey方法代碼示例

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


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

示例1: setDeveloperKey

 /**
  * Set the developer key to use, these are obtained through the API Console.
  * @see http://code.google.com/apis/console-help/#generatingdevkeys
  * @param string $developerKey
  */
 public function setDeveloperKey($developerKey)
 {
     $this->config->setDeveloperKey($developerKey);
 }
開發者ID:hzhou9,項目名稱:coupon_deal,代碼行數:9,代碼來源:Client.php

示例2: register

 public function register(Application $app)
 {
     $app['gapi.services'] = $app->share(function () use($app) {
         $path = __DIR__ . '/../Resources/services.json';
         $data = file_get_contents($path);
         return json_decode($data, true);
     });
     $app['gapi.scopes'] = $app->share(function () use($app) {
         $path = __DIR__ . '/../Resources/scopes.json';
         $data = file_get_contents($path);
         return json_decode($data, true);
     });
     $app['gapi.config'] = $app->share(function () use($app) {
         $options = $app['gapi.options'];
         $config = new \Google_Config();
         if (isset($options['application_name'])) {
             $config->setApplicationName($options['application_name']);
         }
         if (isset($options['client_id'])) {
             $config->setClientId($options['client_id']);
         }
         if (isset($options['client_secret'])) {
             $config->setClientSecret($options['client_secret']);
         }
         if (isset($options['redirect_uri'])) {
             $config->setRedirectUri($options['redirect_uri']);
         }
         if (isset($options['access_type'])) {
             $config->setAccessType($options['access_type']);
         }
         if (isset($options['approval_prompt'])) {
             $config->setApprovalPrompt($options['approval_prompt']);
         }
         if (isset($options['developer_key'])) {
             $config->setDeveloperKey($options['developer_key']);
         }
         return $config;
     });
     $app['gapi.client'] = $app->share(function () use($app) {
         $options = $app['gapi.options'];
         $client = new \Google_Client($app['gapi.config']);
         foreach (array('scope', 'scopes') as $key) {
             if (isset($options[$key]) && $options[$key]) {
                 $scopes = $options[$key];
                 if (!is_array($scopes)) {
                     $scopes = array($scopes);
                 }
                 foreach ($scopes as $scope) {
                     if (isset($app['gapi.scopes'][strtolower($scope)])) {
                         $scope = $app['gapi.scopes'][strtolower($scope)];
                     }
                     $client->addScope($scope);
                 }
             }
         }
         if (isset($options['refresh_token'])) {
             $client->refreshToken($options['refresh_token']);
         }
         return $client;
     });
     $app['gapi.access_token'] = function () use($app) {
         $token = json_decode($app['gapi.client']->getAccessToken());
         if (is_object($token) && isset($token->access_token)) {
             return $token->access_token;
         } else {
             return null;
         }
     };
     foreach ($app['gapi.services'] as $service => $classname) {
         $app['gapi.service.' . $service] = $app->share(function () use($app, $classname) {
             $class = new \ReflectionClass($classname);
             return $class->newInstance($app['gapi.client']);
         });
     }
 }
開發者ID:shineunited,項目名稱:googleclient,代碼行數:75,代碼來源:GoogleClientServiceProvider.php


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