/** * Builder configuration validation * * Checks the current configuration of the Node Builder for errors. This method should be executed before each Node * is built. * * @throws Builder\Exception */ protected function validate() { // verify we have a host address and port if (!$this->config->getHost() || !$this->config->getPort()) { throw new Node\Builder\Exception('Node host address and port number are required.'); } if ($this->config->getUser() && $this->config->getCertificate()) { throw new Node\Builder\Exception('Connect with password OR certificate authentication, not both.'); } if ($this->config->isAuth() && !$this->config->getCaDirectory() && !$this->config->getCaFile()) { throw new Node\Builder\Exception('Certificate authority file is required for authentication.'); } }
/** * Returns host:port for Node * * @return string */ public function getUri() { return sprintf('%s:%s', $this->config->getHost(), $this->config->getPort()); }