Thruway\Procedure::addRegistration PHP Method

addRegistration() private method

Add registration
private addRegistration ( Registration $registration, Thruway\Message\RegisterMessage $msg ) : boolean
$registration Registration
$msg Thruway\Message\RegisterMessage
return boolean
    private function addRegistration(Registration $registration, RegisterMessage $msg)
    {
        try {
            // make sure the uri is exactly the same
            if ($registration->getProcedureName() != $this->getProcedureName()) {
                throw new \Exception('Attempt to add registration to procedure with different procedure name.');
            }
            // make sure options match
            if (strcasecmp($registration->getInvokeType(), $this->getInvokeType()) != 0) {
                throw new \Exception('Registration and procedure must agree on invocation type');
            }
            if ($registration->getDiscloseCaller() != $this->getDiscloseCaller()) {
                throw new \Exception('Registration and procedure must agree on disclose caller');
            }
            $this->registrations[] = $registration;
            $registration->getSession()->sendMessage(new RegisteredMessage($msg->getRequestId(), $registration->getId()));
            // now that we have added a new registration, process the queue if we are using it
            if ($this->getAllowMultipleRegistrations()) {
                $this->processQueue();
            }
            return true;
        } catch (\Exception $e) {
            $registration->getSession()->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg));
            return false;
        }
    }