示例#1
0
 /**
  * {@inheritDoc}
  */
 public function credentials($dbName)
 {
     $creds = $this->cloudEnvironment->serviceCredentials();
     if (!isset($creds['databases'][$dbName])) {
         throw new \OutOfBoundsException('Invalid database: ' . $dbName);
     }
     $database = $creds['databases'][$dbName];
     $host = $this->getCurrentHost($database['db_cluster_id']);
     $database['host'] = $host ?: key($database['db_url_ha']);
     return new DatabaseCredentials($database);
 }
示例#2
0
 /**
  * {@inheritDoc}
  */
 public function credentials()
 {
     $creds = $this->cloudEnvironment->serviceCredentials();
     if (!isset($creds['memcached_servers'])) {
         throw new \OutOfBoundsException('Memcache credentials not found');
     }
     $servers = array();
     foreach ($creds['memcached_servers'] as $id => $url) {
         $data = parse_url($url);
         $servers[$id] = new MemcacheCredentials($data);
     }
     return $servers;
 }