示例#1
0
 /**
  * @param   string  $name
  * @return  bool|ConfigurationInterface
  * @throws  ConnectionException
  */
 public function getConfiguration($name = null)
 {
     if ($this->connections->count() === 0) {
         throw ConnectionException::NoConnectionDefined();
     }
     if (!$name) {
         return $this->getFirst();
     } else {
         if (false === ($conn = $this->findByName($name))) {
             throw ConnectionException::NoConnectionDefinedByName($name);
         } else {
             return $conn;
         }
     }
 }
 /**
  * @return resource
  * @throws ConnectionException
  */
 public function getSocket()
 {
     if (is_null($this->socket)) {
         throw ConnectionException::NotConnected();
     }
     return $this->socket;
 }