public function getEngine($endpoint)
    {
        if ($this->isInitialCall == true) {
            $endpointCached = $endpoint . '-init';
        } else {
            $endpointCached = $endpoint;
        }

        if (!isset($this->engines[$endpointCached])) {
            $endPoints = $this->getOption(self::OPTION_ENGINE_ENDPOINTS);
            
            if (!empty($endPoints[$endpoint])) {
                $engineOptions = $endPoints[$endpoint];
            
                $class = $engineOptions[self::OPTION_ENGINE_CLASS];
                $args = $engineOptions[self::OPTION_ENGINE_ARGS];
                $args = $this->alterTimeoutCallValue($args);
                $url = isset($engineOptions[self::OPTION_ENGINE_URL])
                    ? $engineOptions[self::OPTION_ENGINE_URL]
                    : $endpoint;
                array_unshift($args, $endpoint);

                try {
                    $this->engines[$endpointCached] = new $class($url, $this->getCatEngineVersion($args), $this->getCatEngineClient($args));
                } catch (\Exception $e) {
                    \common_Logger::e('Fail to connect to CAT endpoint : ' . $e->getMessage());
                    throw new CatEngineNotFoundException('CAT Engine for endpoint "' . $endpoint . '" is misconfigured.', $endpoint, 0, $e);
                }

            }
        }
        
        if (empty($this->engines[$endpointCached])) {
            // No configured endpoint found.
            throw new CatEngineNotFoundException("CAT Engine for endpoint '${endpoint}' is not configured.", $endpoint);
        }
        
        return $this->engines[$endpointCached];
    }
public function getEngine($endpoint)
    {
        if ($this->isInitialCall == true) {
            $endpointCached = $endpoint . '-init';
        } else {
            $endpointCached = $endpoint;
        }

        if (!isset($this->engines[$endpointCached])) {
            $endPoints = $this->getOption(self::OPTION_ENGINE_ENDPOINTS);
            
            if (!empty($endPoints[$endpoint])) {
                $engineOptions = $endPoints[$endpoint];
            
                $class = $engineOptions[self::OPTION_ENGINE_CLASS];
                $args = $engineOptions[self::OPTION_ENGINE_ARGS];
                $args = $this->alterTimeoutCallValue($args);
                $url = isset($engineOptions[self::OPTION_ENGINE_URL])
                    ? $engineOptions[self::OPTION_ENGINE_URL]
                    : $endpoint;
                array_unshift($args, $endpoint);

                try {
                    $this->engines[$endpointCached] = new $class($url, $this->getCatEngineVersion($args), $this->getCatEngineClient($args));
                } catch (\Exception $e) {
                    \common_Logger::e('Fail to connect to CAT endpoint : ' . $e->getMessage());
                    throw new CatEngineNotFoundException('CAT Engine for endpoint "' . $endpoint . '" is misconfigured.', $endpoint, 0, $e);
                }

            }
        }
        
        if (empty($this->engines[$endpointCached])) {
            // No configured endpoint found.
            throw new CatEngineNotFoundException("CAT Engine for endpoint '${endpoint}' is not configured.", $endpoint);
        }
        
        return $this->engines[$endpointCached];
    }
public function getEngine ( $ endpoint ) { if ( $ this -> isInitialCall == true ) { $ endpointCached = $ endpoint . '-init' ; } else { $ endpointCached = $ endpoint ; } if ( ! isset ( $ this -> engines [ $ endpointCached ] ) ) { $ endPoints = $ this -> getOption ( self :: OPTION_ENGINE_ENDPOINTS ) ; if ( ! empty ( $ endPoints [ $ endpoint ] ) ) { $ engineOptions = $ endPoints [ $ endpoint ] ; $ class = $ engineOptions [ self :: OPTION_ENGINE_CLASS ] ; $ args = $ engineOptions [ self :: OPTION_ENGINE_ARGS ] ; $ args = $ this -> alterTimeoutCallValue ( $ args ) ; $ url = isset ( $ engineOptions [ self :: OPTION_ENGINE_URL ] ) ? $ engineOptions [ self :: OPTION_ENGINE_URL ] : $ endpoint ; array_unshift ( $ args , $ endpoint ) ; try { $ this -> engines [ $ endpointCached ] = new $ class ( $ url , $ this -> getCatEngineVersion ( $ args ) , $ this -> getCatEngineClient ( $ args ) ) ; } catch ( \ Exception $ e ) { \ common_Logger :: e ( 'Fail to connect to CAT endpoint : ' . $ e -> getMessage ( ) ) ; throw new CatEngineNotFoundException ( 'CAT Engine for endpoint "' . $ endpoint . '" is misconfigured.' , $ endpoint , 0 , $ e ) ; } } } if ( empty ( $ this -> engines [ $ endpointCached ] ) ) { // No configured endpoint found. throw new CatEngineNotFoundException ( "CAT Engine for endpoint '${endpoint}' is not configured." , $ endpoint ) ; } return $ this -> engines [ $ endpointCached ] ; }
Returns the Adaptive Engine

Returns an CatEngine implementation object.
If it is the initial call, change endpoint name to differentiate it from nextItem call

@param string $endpoint
@return CatEngine
@throws CatEngineNotFoundException
Returns the Adaptive Engine