Thruway\Registration::setInvokeType PHP Метод

setInvokeType() публичный Метод

public setInvokeType ( String $type )
$type String
    public function setInvokeType($type)
    {
        $type = strtolower($type);
        $allowedRegistrations = array(Registration::SINGLE_REGISTRATION, Registration::ROUNDROBIN_REGISTRATION, Registration::RANDOM_REGISTRATION, Registration::THRUWAY_REGISTRATION, Registration::FIRST_REGISTRATION, Registration::LAST_REGISTRATION);
        if (in_array($type, $allowedRegistrations)) {
            if ($type !== Registration::SINGLE_REGISTRATION) {
                $this->invokeType = $type;
                $this->setAllowMultipleRegistrations(true);
            } else {
                $this->invokeType = Registration::SINGLE_REGISTRATION;
                $this->setAllowMultipleRegistrations(false);
            }
        }
    }

Usage Example

Пример #1
0
 /**
  * Create Registration from RegisterMessage
  *
  * @param \Thruway\Session $session
  * @param \Thruway\Message\RegisterMessage $msg
  * @return \Thruway\Registration
  */
 public static function createRegistrationFromRegisterMessage(Session $session, RegisterMessage $msg)
 {
     $registration = new Registration($session, $msg->getProcedureName());
     $options = $msg->getOptions();
     if (isset($options->disclose_caller) && $options->disclose_caller === true) {
         $registration->setDiscloseCaller(true);
     }
     if (isset($options->invoke)) {
         $registration->setInvokeType($options->invoke);
     } else {
         if (isset($options->thruway_multiregister) && $options->thruway_multiregister === true) {
             $registration->setInvokeType(Registration::THRUWAY_REGISTRATION);
         } else {
             $registration->setInvokeType(Registration::SINGLE_REGISTRATION);
         }
     }
     return $registration;
 }