The Procedure class is used by the Dealer to keep track of registered procedures.
Beispiel #1
0
 /**
  * process RegisterMessage
  *
  * @param \Thruway\Session $session
  * @param \Thruway\Message\RegisterMessage $msg
  */
 private function processRegister(Session $session, RegisterMessage $msg)
 {
     // check for valid URI
     if (!Utils::uriIsValid($msg->getProcedureName())) {
         $session->sendMessage(ErrorMessage::createErrorMessageFromMessage($msg, 'wamp.error.invalid_uri'));
         return;
     }
     //Check to see if the procedure is already registered
     /** @var Procedure $procedure */
     if (isset($this->procedures[$msg->getProcedureName()])) {
         $procedure = $this->procedures[$msg->getProcedureName()];
     } else {
         $procedure = new Procedure($msg->getProcedureName());
         $this->procedures[$msg->getProcedureName()] = $procedure;
     }
     if ($procedure->processRegister($session, $msg)) {
         // registration succeeded
         // make sure we have the registration in the collection
         // of registrations for this session
         if (!$this->registrationsBySession->contains($session)) {
             $this->registrationsBySession->attach($session, []);
         }
         $registrationsForThisSession = $this->registrationsBySession[$session];
         if (!in_array($procedure, $registrationsForThisSession)) {
             array_push($registrationsForThisSession, $procedure);
             $this->registrationsBySession[$session] = $registrationsForThisSession;
         }
     }
 }
 public function testGetRegistrationByIdFailure()
 {
     $reg = $this->_proc->getRegistrationById(0);
     $this->assertFalse($reg);
 }