resolve the response from add event method

@param mixed $response
@throws CronInstanceException
960044
private function resolveEventResponse($response)
    {
        if (is_string($response)) {
            $response = new ExecTask($response);
        }

        if ($response instanceof TaskReposity && !$response instanceof ClosureTask) {
            EventReposity::addBasic($response);
        } else {
            throw new CronInstanceException(
                sprintf(
                    'Event Response must be an instance of %s and cant be an instance of %s',
                    TaskReposity::class,
                    ClosureTask::class
                )
            );
        }
    }
468866
function process_response($request, $response)
    {
        if (! $request->user->isAnonymous()) {
            $request->session->setData($this->session_key, $request->user->id);
        }
        return $response;
    }
1069472
private function handleResponse($response)
    {
        if ($this->client->newFormatModeEnabled === true) {
            return $response;
        }

        return $this->client->handleHttpResponse($response);
    }
968238
private function whenSuccess($response, $method)
    {
        $this->makeSession($response, $method);
        return $this->result->setData([
            'success' => true,
            'payload' => [
                'redirect' => sprintf('%s%s', $this->baseUrl(), 'pagseguro/direct/success')
            ]
        ]);
    }
735100
public function sendResponse(ResponseInterface $response) : void
    {
        if (!headers_sent()) {
            $this->sendStatusLine($response);
            $this->sendHeaders($response);
        }
        $this->eventDispatcher->dispatch(new EventAfterAppReponseHeadersSending($response));
        $this->sendBody($response);
    }
588514
protected function processResponseType($response = null)
	{
		if ($response instanceof Response) {
			$this->response = $response;
		}
		elseif (is_string($response) || is_numeric($response)) {
			$this->response->setContent($response);
		}
		elseif (is_array($response)) {
			$this->response = new JsonResponse($response);
		}
		else {
			throw new \Exception("App cannot process this response type");
		}
	}
202998
public function failedRequest(Response $response)
    {
        // Decode Response.
        $decodedResponse = json_decode($response->getBody()->getContents(), true);
        // Get error message.
        $errorMessage = (isset($decodedResponse['error_message']) && ! is_null($decodedResponse['error_message'])) ? $decodedResponse['error_message'] : $response->getReasonPhrase();
        // ClientException.
        throw new WatsonBridgeException($errorMessage, $response->getStatusCode());
    }
260089
public function setResponse($response)
    {
        if (!$this->is_rest) {
            $this->response->setSecurityHeaders();
        }

        if ($response instanceof View && $this->response_type == 'html' && !$this->is_rest) {
            $this->response->raw($response->render());
        } elseif (($this->is_rest || $this->response_type == 'json' || is_array($response)) ||
            (is_object($response) && !($response instanceof View))
        ) {
            if ($response instanceof View) {
                throw new Exception(
                    translate('Response can not be a instance of cordillera\\middlewares\\View object'),
                    500,
                    Exception::BADARGUMENTS
                );
            }
            $this->response->json($response);
        }
    }
1081840
protected function _sendResponse($response)
    {
        if (is_string($response)) {
            echo $response;

            return;
        }

        $emitter = new ResponseEmitter();
        $emitter->emit($response);
    }
67904
public function setResponse(Response $response): void
    {
        if ($this->hasResponse()) {
            throw new LogicException('Response can only be set one time.');
        }

        if (!$response->has('ctx_request')) {
            $response->set('ctx_request', $this->message);
        }

        if (!$response->has('ctx_request_ref')) {
            $response->set('ctx_request_ref', $this->message->generateMessageRef());
        }

        if (!$response->has('ctx_correlator_ref') && $this->message->has('ctx_correlator_ref')) {
            $response->set('ctx_correlator_ref', $this->message->get('ctx_correlator_ref'));
        }

        $this->response = $response;
        $this->stopPropagation();
    }
232376
public function prepareForResponse(Response $response) {
		if ('application/json' == $response->getRequest()->getAcceptRange()
	               ->bestMatch(['text/html', 'application/json'])) {
            	$this->payload = new JhtmlJsonPayload($this->additionalAttrs);
               	$this->payload->applyRedirect($this->directive, $this->httpLocation, $this->jhtmlExec);
			$this->payload->prepareForResponse($response);
	        return;
	    } 
	    
		$this->payload = new Redirect($this->httpLocation);
		$this->payload->prepareForResponse($response);
	}
621593
private function checkException($response)
    {
        if ((true === $this->getThrowExceptions()) and ($this->isErroneousResponse($response))) {
            throw new ClientException($response->detail, $response->status);
        }
        return $response;
    }
877283
private function decodeResponse(string $response)
    {
        if (strpos($response, '!') !== false) {
            throw new \Exception($response);
        }

        return new BotScoutResponse($response);
    }
172
public function addResponse($key, array $response)
    {
        $originalRequest = isset($this->request[$key]) ? $this->request[$key] : null;
        $responseBody = isset($response['body']) ? $response['body'] : null;
        $responseError = isset($response['error']) ? $response['error'] : null;
        $responseMethod = isset($response['method']) ? $response['method'] : null;

        $this->responses[$key] = new Response($originalRequest, $responseBody, $responseError, $responseMethod);
    }
522268
protected function addCookieToResponse(Response $response, SessionInterface $session)
	{
		$s = $session;

		if ($this->sessionIsPersistent($c = $this->manager->getSessionConfig()))
		{
			$secure = array_get($c, 'secure', false);

			$response->headers->setCookie(new Cookie(
				$s->getName(), $s->getId(), $this->getCookieLifetime(), $c['path'], $c['domain'], $secure
			));
		}
	}
992146
public function addSuccess(RequestInterface $request, ResponseInterface $response): void
    {
        $this->lastRequest = $request;
        $this->lastResponse = $response;
        $this->success = true;
    }
405726
protected function afterDispatch($response)
    {
        if (!$response instanceof Response) {
            $response = RequestContext::getResponse()->auto($response);
        }

        // Handle Response
        $response->send();

        // Release system resources
        App::trigger(AppEvent::RESOURCE_RELEASE);

        // Trigger 'After Request' event
        App::trigger(HttpServerEvent::AFTER_REQUEST);
    }