Esempio n. 1
0
 /**
  * Construct the Google Client.
  *
  * @param $config Google\Config or string for the ini file to load
  */
 public function __construct($config = null)
 {
     if (is_string($config) && strlen($config)) {
         $config = new Config($config);
     } else {
         if (!$config instanceof Config) {
             $config = new Config();
             if ($this->isAppEngine()) {
                 // Automatically use Memcache if we're in AppEngine.
                 $config->setCacheClass('Google\\Cache\\Memcache');
             }
             if (version_compare(phpversion(), "5.3.4", "<=") || $this->isAppEngine()) {
                 // Automatically disable compress.zlib, as currently unsupported.
                 $config->setClassConfig('Google\\Http\\Request', 'disable_gzip', true);
             }
         }
     }
     if ($config->getIoClass() == Config::USE_AUTO_IO_SELECTION) {
         if (function_exists('curl_version') && function_exists('curl_exec') && !$this->isAppEngine()) {
             $config->setIoClass("Google\\IO\\Curl");
         } else {
             $config->setIoClass("Google\\IO\\Stream");
         }
     }
     $this->config = $config;
 }
Esempio n. 2
0
 /**
  * @return string the name of the application
  */
 public function getApplicationName()
 {
     return $this->config->getApplicationName();
 }