Send the repsonse back to the client.

@param  \Symfony\Component\HttpFoundation\Response  $response
@return mixed
337294
protected function sendResponse($response)
	{
		return $this->responsePreparer->readyForResponses() && ! $this->runningInConsole()
								? $response
								: $response->send();
	}
1252506
protected function sendResetLinkFailedResponse(Request $request, $response)
    {
        return back()
                ->withInput($request->only('email'))
                ->withErrors(['email' => trans($response)]);
    }
821791
protected function dispatch($request, $response)
    {
        $this->setRequest($request);
        $this->setResponse($response);
        if (!$this->responder) {
            $this->responder = Respond::getResponder();
        }
        return $this->_execInternalMethods();
    }
469071
public function run(Request $request, Response $response) : Response {

		$strict = $this->getParam('STRICT_ROUTING');
		$case = $this->getParam('CASE_SENSITIVE');
		$method = $request->getMethod();
		$url = $request->getUri()->getPath();

		//Matching
		foreach($this->routes as $route) {
			if($route->match($url, $strict, $case) && $method == $route->getMethod()) {
				return $route->call($request, $response);
			} elseif($route->match($url, $strict, $case) && $method == 'HEAD') {
				$body = $response->getBody();
				$body->close();
				$response = $response->withBody($body);
				return $response;
			}
		}

		//Error
		$methods = array();
		foreach($this->routes as $route) {
			array_push($methods, $route->getMethod());
			if($route->match($url, $strict, $case) && $method != $route->getMethod() && in_array($method, self::$_METHODS))
				return call_user_func($this->httpErrors['405'], $request, $response);

			elseif($route->match($url, $strict, $case) && $method != $route->getMethod() && !in_array($method, self::$_METHODS))
				return call_user_func($this->httpErrors['400'], $request, $response);
		}

		if(!in_array($method, $methods) && !in_array($method, self::$_METHODS))
			return call_user_func($this->httpErrors['400'], $request, $response);
		else
			return call_user_func($this->httpErrors['404'], $request, $response);
		
	}
1049331
public function prepareResponse( $request, $response )
	{
		if ( $response instanceof PsrResponseInterface )
			$response = ( new HttpFoundationFactory )->createResponse( $response );
		elseif ( !$response instanceof SymfonyResponse )
			$response = new Response( $response );

		return $response->prepare( $request );
	}
762110
public function send(Response $response): void
    {
        // send http header:
        $httpHeader = sprintf(
            'HTTP/%s %d %s',
            $response->getProtocolVersion(),
            $response->getStatus(),
            $response->getStatusMessage()
        );
        header($httpHeader, true);

        // send additional headers:
        foreach ($response->getHeaders() as $name => $value) {
            header(sprintf('%s: %s', $name, $value), true);
        }

        // send body:
        echo $response->getBody();
    }
1133182
public function behave(Response $response)
    {
        return new Response(
            json_decode($response->content(), true),
            $response->contentType(),
            $response->error(),
            $response->errorCode(),
            $response->headerLines(),
            $response->statusCode()
        );
    }
416000
public function makeResponse(Request $request, Response $response, Responder $responder): Response
    {
        return $responder(
            $request,
            $response,
            new Payload(
                $this->getCode(),
                '',
                $this->getMessage()
            )
        );
    }
1021278
protected function setPsrResponse( \Psr\Http\Message\ResponseInterface $response )
	{
		$this->response->setStatus( $response->getStatusCode() );

		foreach( $response->getHeaders() as $key => $value ) {
			foreach( (array) $value as $val ) {
				$this->response->setHeader( $key, $val );
			}
		}

		return (string) $response->getBody();
	}
860479
protected function sendResetLinkResponse(Request $request, $response)
    {
        if ($request->expectsJson()) {
            return response()->json([
                'status' => trans($response)
            ]);
        }
        return back()->with('status', trans($response));
    }
1091223
public function after($response)
	{
		// Make sure the $response is a Response object
		if ( ! $response instanceof Response)
		{
			$response = \Response::forge($response, $this->response_status);
		}

		return $response;
	}
628272
protected function finishRequest(Response $response)
    {
        $event = new FinishRequestEvent($this->app, $response);
        $this->event_dispatcher->dispatch(DietcubeEvents::FINISH_REQUEST, $event);

        $response = $event->getResponse();

        $response->sendHeaders();
        $response->sendBody();

        return $response;
    }
1273745
public function sendBody(ResponseInterface $response)
    {
        $range = $this->getContentRange($response->getHeaderLine('content-range'));

        $maxBufferLength = $this->getMaxBufferLength() ?: 8192;

        if ($range === false) {
            $body = $response->getBody();

            if ($body->isSeekable()) {
                $body->rewind();
            }

            while (!$body->eof()) {
                echo $body->read($maxBufferLength);

                $this->delay();
            }

            return;
        }

        list($unit, $first, $last, $length) = array_values($range);

        ++$last;

        $body = $response->getBody();
        $body->seek($first);
        $position = $first;

        while (!$body->eof() && $position < $last) {
            // The latest part
            if (($position + $maxBufferLength) > $last) {
                echo $body->read($last - $position);

                $this->delay();

                break;
            }

            echo $body->read($maxBufferLength);

            $position = $body->tell();

            $this->delay();
        }
    }
478198
protected function respond($response)
    {
        if ($response === null) {
            return $this->mapResponse(true, []);
        }

        if (!empty($response) && !isset($response[0])) {
            $success = null === Arr::get($response, 'error_code');

            return $this->mapResponse($success, $response);
        }

        $responses = [];

        foreach ($response as $responseItem) {
            $success = null === Arr::get($responseItem, 'error_code');

            $responses[] = $this->mapResponse($success, $responseItem);
        }

        return $responses;
    }
779336
protected function respond($response)
    {
        if (Arr::get($response, 'object') === 'list') {
            if (!empty($response['data'])) {
                foreach ($response['data'] as $responseItem) {
                    $success = Arr::get($responseItem, 'object', 'error') !== 'error';

                    $responses[] = $this->mapResponse($success, $responseItem);
                }

                return $responses;
            } else {
                $response = $response['data'];
            }
        }

        $success = Arr::get($response, 'object', 'error') !== 'error';

        return $this->mapResponse($success, $response);
    }
886165
protected function send(
        ResponseInterface $response,
        string $body): ResponseInterface
    {
        if (!$body) {
            $response = $this->sendErrorDocument($response);
        }
        unset($this->errorDocument);
        $response = $response->withHeader(
            Response::HEADER_CONTENT_LENGTH,
            (string) strlen($body));
        header(Response::PROTOCOL
             . $response->getProtocolVersion() . " "
             . $response->getStatusCode() . " "
             . $response->getReasonPhrase());
        foreach ($response->getHeaders() as $key => $value) {
            header($key . ": " . implode("; ", $value));
        }
        $response->getBody()->write($body);
        return $response;
    }
1052718
private function sendResponse($code, $message, $response = null) {
        $ret = [
            'code' => $code,
            'message' => $message,
        ];
        if ($response) {
            $ret['response'] = $response;
        }
        return $ret;
    }