/** * Add Endpoint into the pool. * * @param Endpoint $newEndpoint * * @throws InputException */ public function addEndpoint(Endpoint $newEndpoint) { if ($this->hasEndpoint((string) $newEndpoint->getUri())) { throw new InputException('Endpoint already added'); } // all newly added Endpoints are set to DISABLED, apart from the first one $status = $this->getEndpoints()->isEmpty() ? Endpoint::STATUS_ACTIVE : Endpoint::STATUS_DISABLED; $newEndpoint->setStatus($status); $this->getEndpoints()->add($newEndpoint); }