@param array  $errorValues
@param array  $errors
@param string $funcName
@param string $propertyName

@return string
559525
private function buildErrorMessage(array $errorValues, array &$errors, $funcName, $propertyName)
    {
        $message = \str_replace(':attribute', "'".$propertyName."'", $errors[$funcName]);

        foreach ($errorValues as $key => $value) {
            $message = \str_replace(":{$key}", $value, $message);
        }

        return $message;
    }
907127
function formatErrors(errors) {
    return errors.map(error => {
        if (error.keyword === "additionalProperties") {
            const formattedPropertyPath = error.dataPath.length ? `${error.dataPath.slice(1)}.${error.params.additionalProperty}` : error.params.additionalProperty;

            return `Unexpected top-level property "${formattedPropertyPath}"`;
        }
        if (error.keyword === "type") {
            const formattedField = error.dataPath.slice(1);
            const formattedExpectedType = Array.isArray(error.schema) ? error.schema.join("/") : error.schema;
            const formattedValue = JSON.stringify(error.data);

            return `Property "${formattedField}" is the wrong type (expected ${formattedExpectedType} but got \`${formattedValue}\`)`;
        }

        const field = error.dataPath[0] === "." ? error.dataPath.slice(1) : error.dataPath;

        return `"${field}" ${error.message}. Value: ${JSON.stringify(error.data)}`;
    }).map(message => `\t- ${message}.\n`).join("");
}
1357522
private function checkIfRequestIsValidOrThrowException($invalidValues)
    {
        if (!empty($invalidValues)) {
            $exception = new InvalidRequestException('Errors occurred while parsing the request');
            $exception->setErrors($invalidValues);
            throw $exception;
        }
    }
953223
public function getPropertyValidators($propertyName = null)
    {
        if ($propertyName !== null) {
            return $this->propertyValidators[$propertyName] ?? [];
        }
        return $this->propertyValidators;
    }
379996
public function getParams(&$errors = null) {
		$ary    = [];
		$fields = $this->__vars;
		foreach ($fields as $field => $v) {
			$value = $this->{$field};
			if (is_null($value)) {
				continue;
			}
			$ary[ $field ] = $value;
		}
		unset($obj, $vars, $var);
		if ($fields) {
			try {
				$this->validateNewData($ary);
			} catch (ValidateException $e) {
				$errors = $e->getErrors();

				return null;
			}
		}

		return $ary;
	}
1055834
public function validateProperty(string $propertyName): void
    {
        $errors = $this->validator->validateProperty($this->dataObject, $propertyName);
        $this->throwExceptionIfErrors($errors);
    }
188787
public function addError($errorKey, $errorValue)
    {
        if (!isset($this->errors[$errorKey])) {
            $this->errors[$errorKey] = [];
        }
        $this->errors[$errorKey][] = $errorValue;
    }
79466
public function setCustomProperty($propertyName, $propertyValue = '', $propertyType = null)
    {
        if (($propertyType === null) || (!in_array($propertyType, array(self::PROPERTY_TYPE_INTEGER,
                                                                        self::PROPERTY_TYPE_FLOAT,
                                                                        self::PROPERTY_TYPE_STRING,
                                                                        self::PROPERTY_TYPE_DATE,
                                                                        self::PROPERTY_TYPE_BOOLEAN)))) {
            if ($propertyValue === null) {
                $propertyType = self::PROPERTY_TYPE_STRING;
            } elseif (is_float($propertyValue)) {
                $propertyType = self::PROPERTY_TYPE_FLOAT;
            } elseif (is_int($propertyValue)) {
                $propertyType = self::PROPERTY_TYPE_INTEGER;
            } elseif (is_bool($propertyValue)) {
                $propertyType = self::PROPERTY_TYPE_BOOLEAN;
            } else {
                $propertyType = self::PROPERTY_TYPE_STRING;
            }
        }

        $this->customProperties[$propertyName] = array(
            'value' => $propertyValue,
            'type' => $propertyType
        );
        return $this;
    }
689818
public void assertStringNotEmpty(String propertyValue, String propertyName) {
        if (StringUtils.isNullOrEmpty(propertyValue)) {
            problemReporter.report(new Problem(this, String.format("%s is a required property.", propertyName)));
        }
    }
914717
private static function error($n) {

		$messages = [
			JSON_ERROR_DEPTH 	 		=> 'Maximum stack depth exceeded',
            JSON_ERROR_CTRL_CHAR 		=> 'Unexpected control character found',
            JSON_ERROR_SYNTAX 	 		=> 'Syntax error, malformed JSON',
            static::FIREBASE_GENERAL	=> 'Firebase encountered an unknown error',
            static::INVALID_OPTION		=> 'The Token Configuration Service encountered an invalid option in the configuration'
		];

		throw new \UnexpectedValueException($messages[$n] ?: 'Unknown Error: '.$n);
	}
724440
public function normalize(ErrorDoc $errorDoc) : array
    {
        $requiredDoc = ['required' => ['code']];
        $properties = [
            'code' => ['example' => $errorDoc->getCode()]
        ];
        if (null !== $errorDoc->getDataDoc()) {
            $properties['data'] = $this->typeDocNormalizer->normalize($errorDoc->getDataDoc());
            if (false !== $errorDoc->getDataDoc()->isRequired()) {
                $requiredDoc['required'][] = 'data';
            }
        }
        if (null !== $errorDoc->getMessage()) {
            $properties['message'] = ['example' => $errorDoc->getMessage()];
        }

        return [
            'title' => $errorDoc->getTitle(),
            'allOf' => [
                $this->shapeNormalizer->getErrorShapeDefinition(),
                (['type' => 'object'] + $requiredDoc + ['properties' => $properties]),
            ],
        ];
    }
789416
function errorJSON (err) {
  var res = {}
  Object.getOwnPropertyNames(err).forEach(function (key) {
    res[key] = err[key]
  }, err)
  return res
}
906362
protected function saveSimpleProperty($propertyValues)
    {
        $propertyMap = tao_helpers_form_GenerisFormFactory::getPropertyMap();
        $property = $this->getProperty(tao_helpers_Uri::decode($propertyValues['uri']));
        $type = $propertyValues['type'];
        $range = (isset($propertyValues['range']) ? tao_helpers_Uri::decode(trim($propertyValues['range'])) : null);
        unset($propertyValues['uri']);
        unset($propertyValues['type']);
        unset($propertyValues['range']);
        $rangeNotEmpty = false;
        $values = array(
            ValidationRuleRegistry::PROPERTY_VALIDATION_RULE => array()
        );

        if (isset($propertyMap[$type])) {
            $values[WidgetRdf::PROPERTY_WIDGET] = $propertyMap[$type]['widget'];
            $rangeNotEmpty = ($propertyMap[$type]['range'] === OntologyRdfs::RDFS_RESOURCE  );
        }

        foreach($propertyValues as $key => $value){
            if (is_string($value)) {
                $values[tao_helpers_Uri::decode($key)] = tao_helpers_Uri::decode($value);
            } elseif (is_array($value)) {
                $values[tao_helpers_Uri::decode($key)] = $value;
            } else {
                $this->logWarning('Unsuported value type '.gettype($value));
            }
        }

        $rangeValidator = new tao_helpers_form_validators_NotEmpty(array('message' => __('Range field is required')));
        if($rangeNotEmpty && !$rangeValidator->evaluate($range)){
            throw new Exception($rangeValidator->getMessage());
        }

        $this->bindProperties($property, $values);

        // set the range
        $property->removePropertyValues($this->getProperty(OntologyRdfs::RDFS_RANGE));
        if(!empty($range)) {
            $property->setRange($this->getClass($range));
        } elseif (isset($propertyMap[$type]) && !empty($propertyMap[$type]['range'])) {
            $property->setRange($this->getClass($propertyMap[$type]['range']));
        }

        // set cardinality
        if(isset($propertyMap[$type]['multiple'])) {
            $property->setMultiple($propertyMap[$type]['multiple'] == GenerisRdf::GENERIS_TRUE);
        }
    }
345665
public static function formatValidationErrors($errors)
    {
        $msg = array();
        foreach ($errors as $i) {
            if (!is_array($i)) {
                throw new Kwf_Exception('Form errors must be of type array');
            }
            $name = '';
            if (isset($i['field'])) {
                $name = $i['field']->getFieldLabel();
                if (!$name) $name = $i['field']->getName();
            }
            if (isset($i['message'])) {
                $i['messages'] = array($i['message']);
            }
            foreach ($i['messages'] as $m) {
                $msg[] = ($name ? ($name.': ') : '').Kwf_Util_HtmlSpecialChars::filter($m);
            }
        }
        return $msg;
    }
654580
function errors($fieldname) {
		if ($fieldname == null) {
			return null;
		}
		else { # field errors
			if ($this->errors !== null) {
				if (isset($this->errors[$fieldname])) {
					return $this->errors[$fieldname];
				}
				else { # not set
					return null;
				}
			}
		}
	}
1182176
public function getList($propertyValues, $propertyKeys = null, $uniqueValues = false) {
		$this->initialize($propertyValues);
		
		$list = [];		
		
		if ($propertyKeys === true) {
			$propertyKeys = $this->getPrimary();
		}
		
		if ($propertyKeys === null) {
			foreach($this->_map as $key) {
				if (isset($this->_data[$key][$propertyValues])) {
					$list[] = $this->_data[$key][$propertyValues];
				}
			}
		} else {
			foreach ($this->_map as $key) {
				if (isset($this->_data[$key][$propertyKeys], $this->_data[$key][$propertyValues])) {
					$list[$this->_data[$key][$propertyKeys]] = $this->_data[$key][$propertyValues];
				}
			}
		}
		
		if ($uniqueValues === true) {
			return array_unique($list);
		}
		
		return $list;
	}
297305
private function formatErrorMessage($errors = array())
    {
        $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $appConfigForm = $melisMelisCoreConfig->getItem('meliscore/forms/melis_core_platform_scheme_form');
        $appConfigForm = $appConfigForm['elements'];

        foreach ($errors as $keyError => $valueError) {
            foreach ($appConfigForm as $keyForm => $valueForm) {
                if ($valueForm['spec']['name'] == $keyError &&
                    !empty($valueForm['spec']['options']['label'])
                )
                    $errors[$keyError]['label'] = $valueForm['spec']['options']['label'];
            }
        }

        return $errors;
    }