private function discoverServiceInterface(CNabuMessagingService $nb_service) : INabuMessagingServiceInterface
    {
        $retval = false;
        $nb_engine = CNabuEngine::getEngine();

        if (is_string($interface_name = $nb_service->getInterface())) {
            if (is_array($this->nb_service_interface_list) &&
                array_key_exists($interface_name, $this->nb_service_interface_list)
            ) {
                $retval = $this->nb_service_interface_list[$interface_name];
            } elseif (
                is_string($provider_key = $nb_service->getProvider()) &&
                count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 &&
                ($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule &&
                ($retval = $nb_manager->createServiceInterface($interface_name)) instanceof INabuMessagingServiceInterface
            ) {
                if (is_array($this->nb_service_interface_list)) {
                    $this->nb_service_interface_list[$interface_name] = $retval;
                } else {
                    $this->nb_service_interface_list = array($interface_name => $retval);
                }
                $retval->connect($nb_service);
            } else {
                throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_INSTANCE);
            }
        } else {
            throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_CLASS_NAME);
        }

        return $retval;
    }
private function discoverServiceInterface(CNabuMessagingService $nb_service) : INabuMessagingServiceInterface
    {
        $retval = false;
        $nb_engine = CNabuEngine::getEngine();

        if (is_string($interface_name = $nb_service->getInterface())) {
            if (is_array($this->nb_service_interface_list) &&
                array_key_exists($interface_name, $this->nb_service_interface_list)
            ) {
                $retval = $this->nb_service_interface_list[$interface_name];
            } elseif (
                is_string($provider_key = $nb_service->getProvider()) &&
                count(list($vendor_key, $module_key) = preg_split("/:/", $provider_key)) === 2 &&
                ($nb_manager = $nb_engine->getProviderManager($vendor_key, $module_key)) instanceof INabuMessagingModule &&
                ($retval = $nb_manager->createServiceInterface($interface_name)) instanceof INabuMessagingServiceInterface
            ) {
                if (is_array($this->nb_service_interface_list)) {
                    $this->nb_service_interface_list[$interface_name] = $retval;
                } else {
                    $this->nb_service_interface_list = array($interface_name => $retval);
                }
                $retval->connect($nb_service);
            } else {
                throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_INSTANCE);
            }
        } else {
            throw new ENabuMessagingException(ENabuMessagingException::ERROR_INVALID_SERVICE_CLASS_NAME);
        }

        return $retval;
    }
private function discoverServiceInterface ( CNabuMessagingService $ nb_service ) : INabuMessagingServiceInterface { $ retval = false ; $ nb_engine = CNabuEngine :: getEngine ( ) ; if ( is_string ( $ interface_name = $ nb_service -> getInterface ( ) ) ) { if ( is_array ( $ this -> nb_service_interface_list ) && array_key_exists ( $ interface_name , $ this -> nb_service_interface_list ) ) { $ retval = $ this -> nb_service_interface_list [ $ interface_name ] ; } elseif ( is_string ( $ provider_key = $ nb_service -> getProvider ( ) ) && count ( list ( $ vendor_key , $ module_key ) = preg_split ( "/:/" , $ provider_key ) ) === 2 && ( $ nb_manager = $ nb_engine -> getProviderManager ( $ vendor_key , $ module_key ) ) instanceof INabuMessagingModule && ( $ retval = $ nb_manager -> createServiceInterface ( $ interface_name ) ) instanceof INabuMessagingServiceInterface ) { if ( is_array ( $ this -> nb_service_interface_list ) ) { $ this -> nb_service_interface_list [ $ interface_name ] = $ retval ; } else { $ this -> nb_service_interface_list = array ( $ interface_name => $ retval ) ; } $ retval -> connect ( $ nb_service ) ; } else { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_INVALID_SERVICE_INSTANCE ) ; } } else { throw new ENabuMessagingException ( ENabuMessagingException :: ERROR_INVALID_SERVICE_CLASS_NAME ) ; } return $ retval ; }
Discover the Service Interface.
@param CNabuMessagingService $nb_service A Messaging Service instance mapped to required Service Interface.
@return INabuMessagingServiceInterface If Service is mapped then returns a valid interface ready to use.
@throws ENabuMessagingException Raises an exception if the designated Service is not valid or applicable.
Discover the Service Interface .