renderValidationErrors

@return array
350412
protected function renderValidationErrors()
    {
        $arguments = $this->controllerContext->getArguments();
        $validationResults = $arguments->getValidationResults();
        $validationErrors = [];
        foreach ($validationResults->getFlattenedErrors() as $key => $errors) {
            $validationError = ['property' => $key, 'errors' => []];
            foreach ($errors as $error) {
                /** @var \TYPO3\Flow\Error\Error $error */
                $validationError['errors'][] = [
                    'message' => $error->getMessage(),
                    'code' => $error->getCode()
                ];
            }
            $validationErrors[] = $validationError;
        }
        return $validationErrors;
    }
655474
public function getErrors()
    {
        $aErrors = Array();
        if (empty( $this->_errors )) {
            if (is_array($this->_getField(self::$ERROR))) {
                foreach ($this->_getField(self::$ERROR) as $error) {
                    $errorCode       = isset( $error[self::$ERROR_CODE] ) ? $error[self::$ERROR_CODE] : 0;
                    $message         = isset( $error[self::$ERROR_MESSAGE] ) ? $error[self::$ERROR_MESSAGE] : '';
                    $consumerMessage = isset( $error[self::$ERROR_CONSUMER_MESSAGE] ) ? $error[self::$ERROR_CONSUMER_MESSAGE] : '';
                    $paySysMessage   = isset( $error[self::$ERROR_PAYSYS_MESSAGE] ) ? $error[self::$ERROR_PAYSYS_MESSAGE] : '';

                    $error = new WirecardCEE_QMore_Error($errorCode, $message);
                    $error->setConsumerMessage($consumerMessage);
                    $error->setPaySysMessage($paySysMessage);

                    $aErrors[] = $error;
                }
            }

            $this->_errors = $aErrors;
        }

        return $this->_errors;
    }
718196
protected function getNormalizedFormFieldErrors()
    {
        $viewBags = session('errors');

        if ( ! ($viewBags instanceof ViewErrorBag) || ! count($viewBags)) {
            return [];
        }

        /** @var MessageBag $errorBag */
        $errorBag = head($viewBags->getBags());

        if ( ! $errorBag->any()) {
            return [];
        }

        $normalized = [];

        foreach ($errorBag->toArray() as $field => $errors) {
            array_set($normalized, $field, $errors);
        }

        return $normalized;
    }
566320
public function getValidationMessage(): array{
        $fields = [];
        foreach ($this->validations as $validation) {
            /* @var Validation $validation */
            if ($validation->getStatus() == Validation::ERROR) {
                if (!isset($fields[$validation->getField()])) {
                    $fields[$validation->getField()] = [];
                }
                var_dump($validation->getMessage());
                array_push($fields[$validation->getField()], $validation->getMessage());
            }
        }
        return $fields;
    }
359286
public function validate() {
		$errors = array();
		if ($this->getType() == self::TYPE_DECLARATIVE) {
			$classDescriptor = $this->getClassDescriptor();
			$constructor = $classDescriptor->getConstructor();
			
			if ($constructor) {
				$params = $constructor->getParameters();
				
				$i=0;
				
				foreach ($params as $param) {
					/* @var $param MoufReflectionParameter */
					if (!$param->isOptional()) {
						if (!$this->moufManager->isParameterSetForConstructor($this->getIdentifierName(), $i)) {
							$name = $this->getIdentifierName();
							if ($this->isAnonymous()) {
								$name = "anonymous instance of class ".$this->getClassName();
							}
							$errors[] = "In instance <em>".$name."</em>, the constructor
									parameter '".$param->getName()."' is compulsory.
									<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
						} elseif (!$param->allowsNull()) {
							$name = $this->getIdentifierName();
							if ($this->isAnonymous()) {
								$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
							}
							if ($this->moufManager->getParameterForConstructor($this->getIdentifierName(), $i) === null) {
								$errors[] = "In instance <em>".$name."</em>, the constructor
									parameter '".$param->getName()."' is null, but the constructor signature does not allow it to be null.
									<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
							}
						}
					}
					if ($this->moufManager->getParameterTypeForConstructor($this->getIdentifierName(), $i) == 'php') {
						$name = $this->getIdentifierName();
						// Ok, we need to check the code.
						$code = $this->moufManager->getParameterForConstructor($name, $i);
						try {
							CodeValidatorService::validateCode($code);
						} catch (Error $e) {
							if ($this->isAnonymous()) {
								$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
							}
							$errors[] = "In instance <em>".$name."</em>, the constructor
									parameter '".$param->getName()."' is using PHP code that contains a parse error: <em>{$e->getMessage()}</em>.
									<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
						}
					}		
					$i++;
				}
			}
			
			foreach ($classDescriptor->getInjectablePropertiesByPublicProperty() as $propertyName=>$moufProperty) {
				$property = $this->getPublicFieldProperty($propertyName);
				if ($property->getOrigin() == 'php') {
					$code = $property->getValue();
					try {
						CodeValidatorService::validateCode($code);
					} catch (Error $e) {
						$name = $this->getIdentifierName();
						if ($this->isAnonymous()) {
							$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
						}
						$errors[] = "In instance <em>".$name."</em>, the public property
									'".$param->getName()."' is using PHP code that contains a parse error: <em>{$e->getMessage()}</em>.
													<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
					}
				}
			}
			
			foreach ($classDescriptor->getInjectablePropertiesBySetter() as $propertyName=>$moufProperty) {
				$property = $this->getSetterProperty($propertyName);
				if ($property->getOrigin() == 'php') {
					$code = $property->getValue();
					try {
						CodeValidatorService::validateCode($code);
					} catch (Error $e) {
						$name = $this->getIdentifierName();
						if ($this->isAnonymous()) {
							$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
						}
						$errors[] = "In instance <em>".$name."</em>, the setter
									'".$param->getName()."' is using PHP code that contains a parse error: <em>{$e->getMessage()}</em>.
											<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
					}
				}
			}
			
			// Now, let's check that the MoufManager instance definition is not using properties that where once declared
			// but that no longer exist in the class:
			
			$definedPublicProperties = $this->moufManager->getParameterNames($this->name);
			if ($definedPublicProperties) {
				$missingPublicProperties = array_diff($definedPublicProperties, array_keys($classDescriptor->getInjectablePropertiesByPublicProperty()));
				foreach ($missingPublicProperties as $missingPublicPropertyName) {
					$name = $this->getIdentifierName();
					if ($this->isAnonymous()) {
						$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
					}
					
					$errors[] = "In instance <em>".$name."</em>, the public property
								'".$missingPublicPropertyName."' is declared but does not exist. It is likely it once existed but was renamed or removed.
										<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
				}
			}
			
			$definedSetters = $this->moufManager->getParameterNamesForSetter($this->name);
			if ($definedSetters) {
				$missingSetters = array_diff($definedSetters, array_keys($classDescriptor->getInjectablePropertiesBySetter()));
				foreach ($missingSetters as $missingSetterName) {
					$name = $this->getIdentifierName();
					if ($this->isAnonymous()) {
						$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
					}
				
					$errors[] = "In instance <em>".$name."</em>, the setter
								'".$missingSetterName."()' is declared but does not exist. It is likely it once existed but was renamed or removed.
										<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
				}
			}
			
			$definedConstructorArguments = $this->moufManager->getParameterNamesForConstructor($this->name);
			if ($definedConstructorArguments) {
				$constructor = $classDescriptor->getConstructor();
				if ($constructor) {
					$nbParameters = $classDescriptor->getConstructor()->getNumberOfParameters();
					$missingConstructorArguments = array_filter($definedConstructorArguments, function($nb) use ($nbParameters) { return $nbParameters <= $nb; });
					foreach ($missingConstructorArguments as $missingArgument) {
						$name = $this->getIdentifierName();
						if ($this->isAnonymous()) {
							$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
						}
					
						$errors[] = "In instance <em>".$name."</em>, the constructor argument
								n°".$missingArgument." is used but does not exist. It is likely it once existed but was removed.
										<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
					}
				} else {
					$name = $this->getIdentifierName();
					$errors[] = "In instance <em>".$name."</em>, parameters are injected in the constructor but the constructor does not exist. It is likely it once existed but was removed.
										<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
				}
				
				
			}
				
		} else {
			$error = $this->moufManager->getErrorOnInstanceCode($this->getIdentifierName());
			if ($error) {
				$name = $this->getIdentifierName();
				if ($this->isAnonymous()) {
					$name = "anonymous instance from class <strong>".$this->getClassName()."</strong>";
				}
				$errors[] = "The instance <em>".$name."</em> is declared by PHP code and is throwing an error message:
								$error
										<a href='".MOUF_URL."ajaxinstance/?name=".urlencode($this->getIdentifierName())."' class='btn btn-success'><i class='icon-pencil icon-white'></i> Edit</a>";
			}
		}
		return $errors;
	}
249588
public function renderMessages()
    {
        $return = '';
        $messages = $this->getForm()->getMessages();
        foreach ($messages as $type => $lines) {
            if ($type == "error") {
                $return .= ErrorsHelper::render($lines);
            } else {
                $return .= MessagesHelper::render($lines, $type);
            }
        }

        return $return;
    }
720374
public function validated()
    {
        if ($this->invalid()) {
            throw new ValidationException($this);
        }

        $results = [];

        $missingValue = Str::random(10);

        foreach (array_keys($this->getRules()) as $key) {
            $value = data_get($this->getData(), $key, $missingValue);

            if ($value !== $missingValue) {
                Arr::set($results, $key, $value);
            }
        }

        return $results;
    }
262724
public function errorArray()
    {
        $messages = [];
        foreach ($this->failures as $key => $rule) {
            foreach ($rule->getFailures() as $fail) {
                $messages[] = $fail;
            }
        }
        return $messages;
    }
309237
public function renderHtmlErrorDetails()
    {
        $error = $this->getThrown();

        $html = $this->renderHtmlError($error);
        while ($error = $error->getPrevious()) {
            $html .= '<h2>'.$this->translator()->translate('Previous error').'</h2>';
            $html .= $this->renderHtmlError($error);
        }

        return $html;
    }
945009
public static function getErrors()
	{
		$list	= array();
		foreach( $this->errors as $errorKey )
			$list[$errorKey]	= self::$rules[$errorKey];
		return $list;
	}
1357020
public function renderOut()
    {
        foreach (Error::all() as $file => $error) {
            foreach ($error as $line) {
                $this->addMessage('Template error: ' . $line . '(' . $file . ')', 'error');
            }
        }
        return $this->render->render();
    }
81920
protected function renderError() {	
	    $error = I18N::translate('The media file was not found in this family tree.');

    	$width  = (mb_strlen($error) * 6.5 + 50) * 1.15;
    	$height = 60;
    	$im     = imagecreatetruecolor($width, $height); /* Create a black image */
    	$bgc    = imagecolorallocate($im, 255, 255, 255); /* set background color */
    	imagefilledrectangle($im, 2, 2, $width - 4, $height - 4, $bgc); /* create a rectangle, leaving 2 px border */
    
    	$this->embedText($im, $error, 100, '255, 0, 0', WT_ROOT . Config::FONT_DEJAVU_SANS_TTF, 'top', 'left');
    
    	http_response_code(404);
    	header('Content-Type: image/png');
    	imagepng($im);
    	imagedestroy($im);
	}
633280
public function getValidationResults()
    {
        $results = new Result();

        foreach ($this as $argument) {
            $argumentValidationResults = $argument->getValidationResults();
            if ($argumentValidationResults === null) {
                continue;
            }

            $results
                ->forProperty($argument->getName())
                ->merge($argumentValidationResults);
        }

        return $results;
    }
691286
public function actionError()
	{
		$response = array();
		$this->message = Yii::t('Api.Controller', 'An unexpected error occured.');
		if ($error=Yii::app()->errorHandler->error)
		{
			$this->status = $error['code'];
			$this->message = $error['message'];
			if (YII_DEBUG)
				$response = $error;
		
		}

		return $this->renderOutput($response);
	}
990140
protected function getRawErrors() {
        foreach ($this->errors as $field => $errors) {
            foreach ($errors as $error) {
                yield $field => $error;
            }
        }
    }
777539
protected function renderFlashMessages()
    {
        $allMessages = $this->controllerContext->getFlashMessageContainer()->getMessagesAndFlush();
        $messages = [];
        foreach ($allMessages as $message) {
            /** @var \TYPO3\Flow\Error\Message $message */
            $messages[] = [
                'message' => $message->render(),
                'title' => $message->getTitle(),
                'severity' => $message->getSeverity()
            ];
        }
        return $messages;
    }
388826
public function getErrors()
    {
        if ($this->errors === null) {
            if ($errors = $this['errors']) {
                foreach ($errors as $key => $error) {
                    $errors[$key] = $this->shapeFor($error);
                }
                $this->errors = $errors;
            } else {
                $this->errors = [];
            }
        }

        return $this->errors;
    }