Short description of method getInteractionResponseProcessing

@access public
@author Joel Bout, <joel.bout@tudor.lu>
@param  Response response
@return oat\taoQtiItem\model\qti\response\interactionResponseProcessing\InteractionResponseProcessing
541731
public function getInteractionResponseProcessing(ResponseDeclaration $response){
        foreach($this->components as $irp){
            if($irp->getResponse() == $response){
                $returnValue = $irp;
                break;
            }
        }
        if(is_null($returnValue)){
            throw new common_Exception('No interactionResponseProcessing defined for '.$response->getIdentifier());
        }
        return $returnValue;
    }
1127599
protected function processTogglResponse($response)
    {
        // We only need to do something if results are paginated
        if ($response->total_count <= 50) {
            return $response->data;
        }

        $reqdata = [];
        $reqdata = json_encode($reqdata);
        $pages = ceil($response->total_count / 50);
        $curr_page = 1;
        $data = $response->data;

        $orig_uri = $this->uri;

        while ($curr_page < $pages) {
            $curr_page++;
            $this->uri .= '&page=' . $curr_page;
            $response = $this->processRequest($reqdata, self::GET);
            $this->_handleError($reqdata, $response);
            foreach ($response->data as $entry) {
                $data[] = $entry;
            }
            $this->uri = $orig_uri;
        }

        return $data;
    }
683532
protected function getResponseAsJson( ResponseInterface $response ) {
        if( $response->hasHeader('Content-Type') ) {
            $typeHeader = $response->getHeader('Content-Type');
            $contentType = array_shift($typeHeader);

            if( stripos( $contentType, 'application/json' ) === 0 ) {
                return json_decode($response->getBody(), false);
            }
        }

        return null;
    }
717661
private function processResponse(ResponseInterface $response)
    {
        if (200 !== $response->getStatusCode()) {
            throw new \RuntimeException('Query to the API server did not result in an appropriate response code');
        }

        $body = guzzle_json_decode((string) $response->getBody(), true);

        if ('OK' !== $body['error']) {
            throw new \RuntimeException('Query to the API server did not result in an appropriate response code');
        }

        return $body;
    }
769993
private function processResponse()
    {
        $xmlstr = '';
        $record = 0;
        foreach ($this->response as $line) {
            if ($record == 1) {
                $xmlstr .= $line;
            } elseif (substr($line, 0, 1) == '<') {
                $record = 1;
            } elseif (preg_match('/^HTTP\/1.[0-9]{1} ([5-9]{1}[0-9]{2}.*)/', $line, $matches)) {

                throw new ConnectionException($this->host . ': Service not available (' . trim($matches[1]) . ')');
            }
        }
        try {
            libxml_use_internal_errors(true);
            $xml = new SimpleXMLElement($xmlstr);
        } catch (\Exception $error) {

            throw new ConnectionException($error->getMessage());
        }
        if((string)$xml->attributes()->status === 'failed' )
        {
            throw new ApiFailedException($xml->error, intval($xml->error['code']));
        }
        if (!isset($error)) {
            // All is well :)
            return $xml;
        }
    }
39365
protected function processResponse($response)
    {
        // If the soap call failed then we need to throw an exception.
        $code = $this->soap->getResponseCode();
        if ($code != 200) {
            throw new \Exception(
                "SOAP client returned status of $code.",
                $code
            );
        }

        return $response;
    }
991517
private function processResponse(Response $response)
    {
        $response = $response->getBody()->getContents();
        $response = json_decode($response, true);

        return $response;
    }
354767
protected function appendAllResponse(ResponseInterface $response): ResponseInterface
    {
        if ($this->append) {
            $this->cors->setResponse('psr-7', $response);
            $this->cors->handle();

            return $this->cors->getResponse();
        }

        return $response;
    }
760389
protected function parseResponse(ResponseInterface $response)
    {
        $content = (string) $response->getBody();

        if(strpos($content, "callback") !== false){
            $lpos = strpos($content, "(");
            $rpos = strrpos($content, ")");
            $content  = substr($content, $lpos + 1, $rpos - $lpos -1);

            return $this->parseJson($content);
        } else if(strpos($content, "access_token=") !== false) {
            $result = array();
            parse_str($content, $result);
            return $result;
        } else {
            return parent::parseResponse($response);
        }
    }
546870
public Future<Void> processClientResponse(final Callable<ClientResponseImpl> response) {
        return m_es.submit(new Callable<Void>() {
            @Override
            public Void call() throws Exception {
                try {
                    ClientResponseImpl resp = response.call();
                    long handle = resp.getClientHandle();
                    m_procedureCallbacks.remove(handle).clientCallback(resp);
                } catch (Exception e) {
                    SNAP_LOG.warn("Error when SnapshotDaemon invoked callback for a procedure invocation", e);
                    /*
                     * Don't think it is productive to propagate any exceptions here, Ideally
                     * they should be handled by the procedure callbacks
                     */
                }
                return null;
            }
        });
    }
211000
protected function handleResponse(Response $response)
    {
        $statusCode = $response->getStatusCode();

        switch ($statusCode) {
            case 401:
                $response = $this->processNotAuthorized();
                break;
        }

        return $response;
    }
920950
public function getBaseResponse()
    {
        if (!isset($this->baseResponse)) {
            $this->baseResponse = new Response();
        }
        
        $response = $this->baseResponse;
        
        if ($response instanceof GlobalEnvironmentInterface && $response->isStale() === false) {
            $response = $response->withGlobalEnvironment(true); // Make sure base response is stale
        }
        
        return $response;
    }
411394
public function get($id)
    {
        $mode = $this->params('mode', false);
        $type = $this->params('type', false);
        $endpoint = $this->params('endpoint', false);
        $annee = $this->params('annee', 0);
        $processStateHandler = $this->getProcessStateHandler();
        $process = $processStateHandler->getProcess($mode, $type, $endpoint, $annee);
        if (is_null($process))
            $process = $processStateHandler->getDefaultProcess($mode, $type, $endpoint, $annee);
        $response = $this->getResponse();
        $response->getHeaders()->addHeaderLine('Content-Type', 'application/json');
        $serializer = $this->getSerializer();
        $processJson = $serializer->serialize($process, 'json');
        $response->setContent($processJson);
        
        return $response;
    }
1062373
protected function wrap(callable $process, $successSpecResult = null): ResponseInterface
    {
        try {
            $result = $process();

        } catch (ValidationException $e) {
            return $this->failWithException($e);

        } catch (UserAuthException $e) {
            return $this->failWithAuth();

        } catch (NotFoundHttpException $e) {
            return $this->failWithNotFound();

        } catch (\Throwable $e) {
            return $this->failWithException($e);
        }

        if(!is_null($successSpecResult)) {
            $result = $successSpecResult;
        }

        if ($result instanceof ResponseInterface) {
            return $result;
        }

        return $this->success($result);
    }
120239
public function replace(InteractionResponseProcessing $newInteractionResponseProcessing){
        $oldkey = null;
        foreach($this->components as $key => $component){
            if($component->getResponse() == $newInteractionResponseProcessing->getResponse()){
                $oldkey = $key;
                break;
            }
        }
        if(!is_null($oldkey)){
            unset($this->components[$oldkey]);
        }else{
            common_Logger::w('Component to be replaced not found', array('TAOITEMS', 'QTI'));
        }
        $this->add($newInteractionResponseProcessing);
    }
944574
private function GetBankingAliasResponse($response)
    {
        if (isset($response->Type)) {
            switch ($response->Type) {
                case BankingAliasType::IBAN:
                    return $this->CastResponseToEntity($response, '\MangoPay\BankingAliasIBAN');
                default:
                    throw new Libraries\Exception('Unexpected response. Wrong BankingAlias Type value');
            }
        } else {
            throw new Libraries\Exception('Unexpected response. Missing BankingAlias Type property');
        }
    }
1169567
public function getResponse()
    {
        if(!$this->_response instanceof DispatcherResponseInterface) {
            $this->_response = clone $this->getObject('dispatcher.response', array(
                'request' => $this->getRequest(),
                'user'    => $this->getUser()
            ));
        }

        return $this->_response;
    }