@param ErrorInterface $error

@return array|null
176074
private function getErrorLinksRepresentation(ErrorInterface $error): ?array
    {
        $linksRepresentation = null;

        if (($value = $error->getLinks()) !== null) {
            $linksRepresentation = $this->getLinksRepresentation($this->getUrlPrefix(), $value);
        }

        if (($value = $error->getTypeLinks()) !== null) {
            $linksRepresentation[DocumentInterface::KEYWORD_ERRORS_TYPE] =
                $this->getLinksListRepresentation($this->getUrlPrefix(), $value);
        }

        return $linksRepresentation;
    }
433175
protected function getErrorsFromForm(FormInterface $form)
    {
        $errors = [];
        /** @var FormError $error */

        if($form->getErrors()->count() === 0 && $form->isRoot() && !$form->isValid()){
            $errors["_self"] = "Empty post data";
        }

        foreach ($form->getErrors() as $error) {
            $key = $error->getOrigin()->getName();
            $errors[($form->isRoot()) ? "_self" : $key] = $error->getMessage();
        }

        foreach ($form->all() as $childForm) {
            if ($childForm instanceof FormInterface) {
                if ($childErrors = $this->getErrorsFromForm($childForm)) {
                    unset($errors["_self"]);
                    $errors = array_merge_recursive($errors, $childErrors);
                }
            }
        }

        return $errors;
    }
923444
protected function validateJson(ResponseInterface $response): array
    {
        try {
            return \GuzzleHttp\json_decode((string) $response->getBody(), true);
        } catch (\Exception $e) {
            return [];
        }
    }
83858
public static function createFromConstraintViolationList(ConstraintViolationListInterface $errors)
    {
        $exception = static::createUnprocessable('Input validation errors.');

        /** @var ConstraintViolationInterface $error */
        foreach ($errors as $error) {
            $exception->errorValidation($error->getPropertyPath(), $error->getMessage());
        }

        return $exception;
    }
223788
private function getExceptionClass($error)
    {
        $errors = [
            'PAUSED' => QueuePausedResponseException::class
        ];
        $exceptionClass = ResponseException::class;
        list($errorCode) = explode(" ", $error);
        if (!empty($errorCode) && isset($errors[$errorCode])) {
            $exceptionClass = $errors[$errorCode];
        }
        return $exceptionClass;
    }
1114179
private function getValidationMessage(ErrorInterface $error): string
    {
        $message = $this->getMessageFormatter()
            ->formatMessage($error->getMessageTemplate(), $error->getMessageParameters());

        return $message;
    }
1311162
private function getStatusCode($error, ResponseInterface $response)
    {
        if ($error instanceof \Throwable && ($error->getCode() >= 400 && $error->getCode() <= 599)) {
            return $error->getCode();
        }

        $status = $response->getStatusCode();
        if (! $status || $status < 400 || $status > 599) {
            $status = 500;
        }
        return $status;
    }
706599
public static function formatError(Error $exception)
    {
        $error = [
            'message' => $exception->getMessage(),
        ];

        $locations = $exception->getLocations();
        if (!empty($locations)) {
            $error['locations'] = array_map(function (SourceLocation $loc) {
                return $loc->toArray();
            }, $locations);
        }

        $previous = $exception->getPrevious();
        if ($previous && $previous instanceof ValidationException) {
            $error['validation'] = $previous->getResult()->getMessages();
        }

        return $error;
    }
871841
public function format(
        RequestInterface $request,
        ResponseInterface $response = null,
        \Exception $error = null
    ) {
        $cache = [];

        return preg_replace_callback(
            '/{\s*([A-Za-z_\-\.0-9]+)\s*}/',
            function (array $matches) use ($request, $response, $error, &$cache) {
                if (isset($cache[$matches[1]])) {
                    return $cache[$matches[1]];
                }

                $result = '';
                switch ($matches[1]) {
                    case 'request':
                        $result = Psr7\str($request);
                        break;
                    case 'response':
                        $result = $response ? Psr7\str($response) : '';
                        break;
                    case 'req_headers':
                        $result = trim($request->getMethod()
                                . ' ' . $request->getRequestTarget())
                            . ' HTTP/' . $request->getProtocolVersion() . "\r\n"
                            . $this->headers($request);
                        break;
                    case 'res_headers':
                        $result = $response ?
                            sprintf(
                                'HTTP/%s %d %s',
                                $response->getProtocolVersion(),
                                $response->getStatusCode(),
                                $response->getReasonPhrase()
                            ) . "\r\n" . $this->headers($response)
                            : 'NULL';
                        break;
                    case 'req_body':
                        $result = $request->getBody();
                        break;
                    case 'res_body':
                        $result = $response ? $response->getBody() : 'NULL';
                        break;
                    case 'ts':
                    case 'date_iso_8601':
                        $result = gmdate('c');
                        break;
                    case 'date_common_log':
                        $result = date('d/M/Y:H:i:s O');
                        break;
                    case 'method':
                        $result = $request->getMethod();
                        break;
                    case 'version':
                        $result = $request->getProtocolVersion();
                        break;
                    case 'uri':
                    case 'url':
                        $result = $request->getUri();
                        break;
                    case 'target':
                        $result = $request->getRequestTarget();
                        break;
                    case 'req_version':
                        $result = $request->getProtocolVersion();
                        break;
                    case 'res_version':
                        $result = $response
                            ? $response->getProtocolVersion()
                            : 'NULL';
                        break;
                    case 'host':
                        $result = $request->getHeaderLine('Host');
                        break;
                    case 'hostname':
                        $result = gethostname();
                        break;
                    case 'code':
                        $result = $response ? $response->getStatusCode() : 'NULL';
                        break;
                    case 'phrase':
                        $result = $response ? $response->getReasonPhrase() : 'NULL';
                        break;
                    case 'error':
                        $result = $error ? $error->getMessage() : 'NULL';
                        break;
                    default:
                        // handle prefixed dynamic headers
                        if (strpos($matches[1], 'req_header_') === 0) {
                            $result = $request->getHeaderLine(substr($matches[1], 11));
                        } elseif (strpos($matches[1], 'res_header_') === 0) {
                            $result = $response
                                ? $response->getHeaderLine(substr($matches[1], 11))
                                : 'NULL';
                        }
                }

                $cache[$matches[1]] = $result;
                return $result;
            },
            $this->template
        );
    }
453441
public function checkResponse(ResponseInterface $response)
    {
        if (isset($this->_errorChecker)) {
            $error = call_user_func($this->_errorChecker, $response);
        } else {
            $error = $this->getResponseError($response);
        }

        if ($error) {
            throw new ResponseErrorException($error, $response);
        }
    }
1353392
protected function getErrorCode($error)
    {
        $code = Arr::get($error, 'code', $error['type']);

        switch ($code) {
            case 'invalid_expiry_month':
            case 'invalid_expiry_year':
                return new ErrorCode('invalid_expiry_date');
                break;
            case 'invalid_number':
            case 'incorrect_number':
            case 'invalid_cvc':
            case 'incorrect_zip':
            case 'card_declined':
            case 'expired_card':
            case 'processing_error':
                return new ErrorCode($code);
                break;
            case 'missing':
                return new ErrorCode('config_error');
                break;
        }
    }
1029573
protected function encodeErrorToArray(ErrorInterface $error): array
    {
        $writer = $this->createErrorWriter();

        // write header
        $this->writeHeader($writer);

        // write body
        $writer->addError($error);

        // write footer
        $this->writeFooter($writer);

        $array = $writer->getDocument();

        return $array;
    }
551900
private function formatErrorMessage(array $error) {
        if (isset($error['messageCode'])) {
            $messageCode = $error['messageCode'];
        } elseif (isset($error['message'])) {
            return $error['message'];
        } else {
            $messageCode = $error['error'];
        }

        // Massage the field name for better formatting.
        $msg = $this->formatMessage($messageCode, $error);
        return $msg;
    }
507979
public function checkParams(array $params, &$error = null)
    {
        $result = array();
        foreach ($this->paramsReq as $param) {
            if (!array_key_exists($param, $params)) {
                $error = 'required '.$param;
                return false;
            }
            $result[$param] = $params[$param];
        }
        foreach ($this->paramsDefault as $param => $default) {
            if (array_key_exists($param, $params)) {
                $result[$param] = $params[$param];
            } else {
                $result[$param] = $default;
            }
        }
        return $result;
    }
392670
private static function readError($error)
    {
        $err = new stdClass();
        $err->message = key($error);
        $err->status = true;

        return $err;
    }
828765
public function get_error_message($rule)
	{
		if (isset($this->error_messages[$rule]))
		{
			return $this->error_messages[$rule];
		}
		elseif (isset($this->error_messages[0]))
		{
			return $this->error_messages[0];
		}

		return null;
	}
933574
public function fromArray(array $error)
    {

        // extract the array with the error information
        list ($type, $message, $file, $line) = array_values($error);

        // initialize and return the error instance
        return new Error($type, $message, $file, $line, ErrorUtil::singleton()->isFatal($type) ? 500 : 0);
    }