예제 #1
0
 /**
  * @return Google\IO\NewAbstract IO implementation
  */
 public function getIo()
 {
     if (!isset($this->io)) {
         $class = $this->config->getIoClass();
         $this->io = new $class($this);
     }
     return $this->io;
 }
예제 #2
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;
 }