Get the proper failed validation response for the request.

@param array $errors

@return \Symfony\Component\HttpFoundation\Response
180355
public function response(array $errors)
    {
        $messages = implode(' ', array_flatten($errors));

        return Response::json(ResponseUtil::makeError($messages), 400);
    }
123987
public function addErrors(array $errors)
    {
        foreach ($errors as $error) {
            if (!$error instanceof ValidationError)
                throw new Exception('Error was not instance of ValidationError: '.$error);
            if (!in_array($error, $this->errors))
                $this->errors[] = $error;
        }

        return $this;
    }
1006062
protected function renderErrorsAsMarkupList(array $errors) {
		$markup = '';
		foreach ($errors as $error) {
			$markup .= '- Error code: ' . $error->getCode() . ' - ' . $error->getMessage() . PHP_EOL;
		}
		return TRUE === empty($markup) ? '' : PHP_EOL . $markup;
	}
757568
public function response(array $errors)
    {
        if ($this->ajax() || $this->wantsJson()) {
            return new JsonResponse($errors, 422);
        }

        return $this->redirector->to($this->getRedirectUrl())
            ->withInput($this->except($this->dontFlash))
            ->withErrors($errors, $this->errorBag);
    }
1065874
public function errors($format = 'array')
    {
        $errorMessage = '';
        $errors = Session::get('errors') ?: false;

        if (!$errors) {
            return false;
        }

        if ($format === 'string') {
            foreach ($errors as $error => $message) {
                $errorMessage .= $message.'<br>';
            }
        } else {
            $errorMessage = Session::get('errors');
        }

        return $errorMessage;
    }
879295
protected function getErrorMessage(array $errors)
    {
        $error_message = '';
        foreach ($errors as $error) {
            $error_message .= $this->parseError($error) . PHP_EOL . PHP_EOL;
        }

        return $error_message;
    }
850870
public function updateBannedEmailFailed(array $errors)
    {
        $url     = handles('antares::ban_management/bannedemails/datatable');
        $message = trans('antares/ban_management::response.bannedemails.update.db-failed', $errors);

        return $this->redirectWithMessage($url, $message, 'error');
    }
57002
public function setErrors($errors) 
	{
		if(is_array($errors)) {
			$this->errors = $errors;
			return $this;
		}
		
		$args = func_get_args();
		$this->errors[$args[0]] = $args[1];
		
		return $this;
	}
1214371
public function getErrors($format = true)
    {
        if (!$format) {
            return $this->errors;
        }

        $formatted = array();

        foreach ($this->errors as $error) {
            $formatted[] = $this->getFormattedError($error);
        }

        return $formatted;
    }
1178952
private function pluckError(array $error) {
        $row = array_intersect_key(
            $error,
            ['field' => 1, 'error' => 1, 'code' => 1]
        );

        $row['message'] = $this->formatErrorMessage($error);
        return $row;
    }
1331863
public static function getRecoverErrors(array $data, array $errors = [])
    {
        //auth_password        Required
        if (!isset($data['auth_password']) || empty($data['auth_password'])) {
            $errors['auth_password'] = 'Cannot be empty';
        }

        //confirm        NOT IN SCHEMA
        if (!isset($data['confirm']) || empty($data['confirm'])) {
            $errors['confirm'] = 'Cannot be empty';
        } else if ($data['confirm'] !== $data['auth_password']) {
            $errors['confirm'] = 'Passwords do not match';
        }

        return $errors;
    }
262086
private function buildGlobalErrors(array $errors, $msg)
    {
        if (!empty($errors)) {
            $msg .= sprintf('%s- errors:', PHP_EOL);

            foreach ($errors as $error) {
                $msg .= sprintf('%s  - %s', PHP_EOL, $error);
            }
        }

        return $msg;
    }
1234143
public function errors(): ValidationErrors
    {
        $errors = new ValidationErrors();
        foreach ($this as $key => $element) {
            if ($element instanceof HasValueValidationInterface) {
                $e = $element->errors();
                if (!$e->empty()) {
                    $errors[$key] = $e;
                }
            }
        }
        return $errors;
    }
1079338
public function getErrorResponse($errors, int $statusCode = self::HTTP_BAD_REQUEST, array $headers = [])
    {
        if (\is_iterable($errors) === true) {
            /** @var iterable $errors */
            $content = $this->getEncoder()->encodeErrors($errors);
        } else {
            \assert($errors instanceof ErrorInterface);
            $content = $this->getEncoder()->encodeError($errors);
        }

        return $this->createJsonApiResponse($content, $statusCode, $headers, true);
    }
104412
public function getRecursiveErrorMessages($formViews, array &$errors = array())
    {
        if (is_array($formViews)) {
            foreach ($formViews as $formView) {
                $this->getRecursiveErrorMessages($formView, $errors);
            }
        } else {
            $viewErrors = $formViews->vars['errors'];

            if (is_object($viewErrors) && $viewErrors instanceof \Traversable) {
                $viewErrors = iterator_to_array($viewErrors);
            }

            /**
             * @var FormView
             * @var $error   FormError
             */
            foreach ($viewErrors as $error) {
                $template = $error->getMessageTemplate();
                $parameters = $error->getMessageParameters();

                foreach ($parameters as $var => $value) {
                    $template = str_replace($var, $value, $template);
                }

                $errors[] = $error;
            }
            if ($formViews->count()) {
                foreach ($formViews->children as $child) {
                    $this->getRecursiveErrorMessages($child, $errors);
                }
            }
        }

        return $errors;
    }
191967
private function formatDateTimeErrors(array $errors)
    {
        $formattedErrors = [];

        foreach ($errors as $pos => $message) {
            $formattedErrors[] = sprintf('at position %d: %s', $pos, $message);
        }

        return $formattedErrors;
    }
246524
public function addErrors(array $errors)
    {
        foreach ($errors as $code => $message) {
            $this->addError($code, $message);
        }
    }