Get a response to return.

@return string|array
160446
public function getResponse($route, $parameters, $config = [])
    {
        // Copy standard response.
        $response = self::$response;

        // Fill the response.
        array_set($response, 'is_error', true);
        array_set($response, 'message', $this->getMessage());
        array_set($response, 'fields', array_keys($this->validator->errors()->messages()));
        array_set($response, 'feedback', $this->validator->errors()->all());
        array_set($response, 'errors', $this->validator->errors());

        if (array_has($config, 'feedback.html')) {
            array_set(
                $response,
                'feedback',
                '<ul><li>'.implode('</li><li>', array_get($response, 'feedback')).'</li></ul>'
            );
        }

        // JSON response required.
        if (request()->ajax() || request()->wantsJson()) {
            return response()
                ->json($response, 422);
        }

        // Redirect response, flash to session.
        session()->flash('is_error', true);
        session()->flash('message', array_get($response, 'message', ''));
        session()->flash('feedback', array_get($response, 'feedback', ''));
        session()->flash('fields', array_get($response, 'fields', []));

        // Redirect to provided route.
        return redirect()
            ->route($route, $parameters)
            ->withErrors($this->getValidator())
            ->withInput();
    }
931504
public function get_return_action() {
        global $PAGE;

        // Web services don't set a URL, we should avoid debugging when ussing the url object.
        if (!WS_SERVER) {
            $params = $PAGE->url->params();
        }

        if (!empty($params['action'])) {
            return $params['action'];
        }
        return '';
    }
283757
protected function getResponse(){

        $post = false;

        // use output parameter if required by the service
        $this->requestUrl.= $this->service['endpoint']
                            ? $this->endpoint
                            : '';

        // set API Key
        $this->requestUrl.= 'key='.urlencode( $this->key );


        switch( $this->service['type'] ){

            case 'POST':

                    $post =  json_encode( $this->service['param'] );

                break;


            case 'GET':
            default:
                    $this->requestUrl.='&'. Parameters::getQueryString( $this->service['param'] );
                break;
        }


        return $this->make( $post );

    }
844508
public function handler(): Response
    {
        $response = [];
        foreach (Bulletin::all() as $bulletin) {
            $response[] = [
                'id' => $bulletin->getId(),
                'createdAt' => $bulletin->getCreatedAt()->getTimestamp(),
                'title' => $bulletin->getTitle(),
                'abstract' => $bulletin->getAbstract(),
                'isDraft' => $bulletin->isDraft(),
                'statistics' => $bulletin->getStatistics()
            ];
        }
        return response($response);
    }
58254
public function getResponse(): ResponseInterface
    {
        if (is_null($this->response)) {
            if (method_exists($this, 'resolve')) {
                $this->setResponse($this->resolve(Response::class)->load());
            } else {
                $response = new Response();
                $this->setResponse($response->load());
            }
        }

        return $this->response;
    }
126125
public function getResponse() {
        $class = $this->getResponseClassName();
        /** @var $response ResponseAbstract */
        $response = new $class;
        $response->setServiceLocator($this->getServiceLocator());
        $response->setException($this->exception)
            ->setHttpCode($this->returnHttpCode)
            ->trace();

        return $response;
    }
1132932
public function getResponse()
	{
	    $id = 'response';
	    if (!$this->has($id)) {
	        $this->set($id, function () {
	            return new Response();
	        });
	    }
	    return $this->get($id);
	}
1170801
public function toResponse(): Response
    {
        $base = [
            'return_code' => is_null($this->fail) ? static::SUCCESS : static::FAIL,
            'return_msg' => $this->fail,
        ];

        $attributes = array_merge($base, $this->attributes);

        if ($this->sign) {
            $attributes['sign'] = Support\generate_sign($attributes, $this->app->getKey());
        }

        return new Response(XML::build($attributes));
    }
409307
public function getReturned()
    {
        $ret = $this->_returnData;

        // noone needs the responseFingerprintOrder and responseFingerprint in the shop.
        if (array_key_exists('responseFingerprintOrder', $ret)) {
            unset( $ret['responseFingerprintOrder'] );
        }

        if (array_key_exists('responseFingerprint', $ret)) {
            unset( $ret['responseFingerprint'] );
        }

        return $ret;
    }
974929
public function getResponse()
    {
        $this->response = new ResponseDocument();
        $this->response->addElement("responseDate", $this->toUtcDateTime(new \DateTime()));
        $requestNode = $this->response->createElement("request", $this->repository->getBaseUrl());
        $this->response->getDocument()->documentElement->appendChild($requestNode);

        try {
            $this->checkVerb();
            $verbOutput = $this->doVerb();

            // we are sure now that all request variables are correct otherwise an error would have been thrown
            foreach ($this->params as $k => $v) {
                $requestNode->setAttribute($k, $v);
            }

            // the element is only added when everything went fine, otherwise we would add error node(s) in the catch
            // block below
            $this->response->getDocument()->documentElement->appendChild($verbOutput);

            // Shift the records from the records stack and add them to the DOM tree
            // Records proper are always stored in the 'metadata' node
            foreach ($this->response->getDocument()->getElementsByTagName('metadata') as $item) {
                $record = array_shift($this->records);
                $node = $this->response->getDocument()->importNode($record->documentElement, true);
                $item->appendChild($node);
            }
        } catch (MultipleExceptions $errors) {
            //multiple errors happened add all of the to the response
            foreach ($errors as $error) {
                $this->response->addError($error);
            }
        } catch (\Exception $error) {
            //add this error to the response
            if ($error instanceof Exception) {
                $this->response->addError($error);
            } else {
                $this->response->addError(new Exception($error->getMessage()));
            }
        }

        return $this->response->getResponse();
    }
111390
public function getResult() {
		if (!$this->result && $this->response && $this->response->getHttpStatus() >= 200 && $this->response->getHttpStatus() < 300) {
			// decode the response
			$this->result = json_decode($this->response->getRawResponse());
		}

		return $this->result;
	}
1060405
protected function response($response) {
    // Check for HTTP response error codes.
    if ($this->client->error) {
      $this->onErrorResponse(
        $this->client->errorCode,
        $this->client->errorMessage,
        $response
      );
    }
    else {
      $this->onSuccessfulResponse($response);
    }
    return $response;
  }
567549
public function getPayPalResponse()
    {
        $service = $this->getPayPalService();
        $request = $this->getPayPalRequest();

        return $service->doCapture($request);
    }
431361
private function returnResponse($result): Response
    {
        if ($result instanceof Response) {
            return $result;
        }

        if (is_array($result)) {
            $result = json_encode($result);
        }

        return new Response(200, [], $result);
    }
1280779
public function getArray()
  {
    $errors = empty($this->errors) ? null : $this->errors;

    $response = array(
        'status' => $this->getStatus(),
        'data'   => $this->data,
        'errors' => $errors,
    );

    if (!is_null($this->code)) {
      $response['code'] = $this->code;
    }

    if (!is_null($this->message)) {
      $response['message'] = $this->message;
    }

    return $response;
  }
1066937
public function buildResponse()
    {
        $return = array();
        foreach ($this->response as $k => $v)
        {
            $return[$k] = str_replace(array_map(function ($name){
                return '{' . $name . '}';
            }, array_keys($this->config['fake'])), array_values($this->config['fake']), $v);
        }

        return $return;
    }
602794
protected function response()
	{
		if (!isset($this->response)) {
			$this->response = Response::make();
		}
		
		return $this->response;
	}