Run the validation on a key of the given scope.

@param string    $key
@param array     $scope
@param array     $input
@return array
346130
private function getErrors(string $key, array $scope, array $input): array
    {
        $errors = [];

        foreach ($this->rules as $rule) {

            try {

                $rule->validate($key, $scope, $input);

            }

            catch (ValidationException $e) {

                $parameters = $e->getParameters();

                $errors[] = new ValidationError($rule->getName(), $parameters);

            }

        }

        return $errors;
    }
1334654
protected function setValidationError($key, $val)
    {
        if (!in_array('submit', $val)) {
            // Is $validator is instance of ValidatorInterface and given key has error associated
            // then add a span tag below the input element and display error.
            if ($this->validator instanceof ValidatorInterface && $this->validator->hasError($key)) {
                $this->elements[self::$formHolder[self::$formName]][$key.'.error'] =
                    '<span class="'.$this->errorClass.'">'.$this->validator->getErrors($key).'</span>'.PHP_EOL;
            }
        }
    }
1324305
function(key){
                            /* check if null */
                            if ($scope.json[key] === null);

                            /* check if undefined or "" */
                            else if ($scope.json[key] === undefined || $scope.json[key] === '') $scope.json[key] = null;

                            /* try to convert string to number */
                            else if (!isNaN(+$scope.json[key]) && isFinite($scope.json[key]))
                                $scope.json[key] = +$scope.json[key];

                            /* try parse to function */
                            else if ($scope.utils.tryGetFunction($scope.json[key])){
                                $scope.json[key] = $scope.utils.tryGetFunction($scope.json[key]);
                                $scope.utils.textarea.init(key);
                            }

                            /* try to parse string to json */
                            else {
                                if ($scope.node.isHighEditLevel){ /* if high editable level */
                                    try {
                                        var json = JSON.parse($scope.json[key]);
                                        $scope.json[key] = json;
                                        $scope.refresh();
                                    } catch (e){}
                                } else { /* if low editable level */
                                    /* check if boolean input -> then refresh */
                                    if ($scope.json[key] === "true" || $scope.json[key] === "false") {
                                        $scope.json[key] = JSON.parse($scope.json[key]);
                                        $scope.refresh();
                                    }
                                }
                            }
                        }
788799
public function set($key, Input $input): self
    {
        if (!$input->isValid()) {
            return $this;
        }

        $value = $input->value();

        $this->mapOfValues[$key] = $value;

        return $this;
    }
61645
protected function makeValidationRuleDataFromSpecialArraySyntax(array $rules, $key)
    {
        $data = new ValidationRuleData(
            array_get($rules, 'rules', []),
            array_get($rules, 'key', is_numeric($key) ? null : $key)
        );

        if (array_has($rules, 'translated')) {
            $data->setIsTranslated((bool) $rules['translated']);
        }

        if (array_has($rules, 'locale_index')) {

            // @codeCoverageIgnoreStart
            if ((int) $rules['locale_index'] < 1) {
                throw new UnexpectedValueException(
                    "Locale index for configured validation data cannot be less than 1 (key/index: {$key})"
                );
            }
            // @codeCoverageIgnoreEnd

            $data->setLocaleIndex((int) $rules['locale_index']);
        }

        return $data;
    }
532979
public function validateOptions(string $key, array $def, $value)
    {
        if (isset($def['options']) && $value != '') {
            if (isset($def['min']) || isset($def['max'])) {
                if (!is_array($value)) {
                    $this->addError($key, 'form.value_must_be_list');
                } else {
                    if (isset($def['min']) && count($value) < $def['min']) {
                        $this->addError($key, 'form.value_min_options_selected', array('%limit%' => $def['min']));
                    }

                    if (isset($def['max']) && count($value) > $def['max']) {
                        $this->addError($key, 'form.value_max_options_selected', array('%limit%' => $def['max']));
                    }
                }
            }

            if (is_array($value)) {
                foreach ($value as $option => $order) {
                    if (is_int($option)) {
                        if (!isset($def['options'][$order])) {
                            $this->addError($key, 'form.value_invalid_option', array('%option%' => $order));
                        }
                    } else {
                        if (!isset($def['options'][$option])) {
                            $this->addError($key, 'form.value_invalid_option', array('%option%' => $option));
                        }
                    }
                }
            } else {
                if (!isset($def['options'][$value])) {
                    $this->addError($key, 'form.value_invalid_option', array('%option%' => $value));
                }
            }
        }
    }
834945
protected function performValidate($key, &$value)
    {
        if (!$filter = $this->_schema['filter'][$key])
            return true;

        $validation = Validation::instance();
        $moe = Base::instance();
        $field = $this->_properties['fields'][$key];
        foreach ($filter as $func => $param) {
            if (is_numeric($func)) {
                $func = $param;
                $args = array();
            } else
                $args = [$param];

            $function = $func;
            if (method_exists($validation, $func))
                $func = array($validation, $func);
            elseif (method_exists($this, $func) ||
                preg_match('/^('.self::Magic.')/', $func))
                $func = array($this, $func);
            elseif (method_exists($moe, $func))
                $func = array($moe, $func);

            array_unshift($args, $value);
            if (false === $result = $moe->call($func, $args)) {
                $this->_messages[] = $validation->message($function, $field, $value, $param);
                return false;
            } else
                is_bool($result) || $value = $result;
        }

        return true;
    }
1232998
function(key){
                                //handle only if the field has been changed
                                if ($scope.utils.textarea.valueBeforeEditing !== $scope.jsonFn[key]) {
                                    $scope.$emit('onFunctionChanged'); //emit onFunctionChange event if the function definition was changed.

                                    var func = $scope.utils.tryGetFunction($scope.jsonFn[key]);
                                    if (func) $scope.json[key] = func;
                                    else { //if value is not a valid function
                                        $scope.json[key] = $scope.jsonFn[key];
                                        delete $scope.jsonFn[key];
                                        $scope.utils.validateNode(key); //full validation for node
                                    }
                                }
                            }
770993
protected function _validate($key, $val)
    {
        // try each rule function
        foreach ($this->rules as $rule => $is_true) {
            if ($is_true) {
                $function = $this->functions[$rule];
                $args = $this->arguments[$rule]; // Arguments of rule

                $valid = true;
                if(is_array($val)) {
                    foreach($val as $v) {
                        $valid = $valid && (empty($args)) ? $function($v) : $function($v, $args);
                    }
                } else {
                    $valid = (empty($args)) ? $function($val) : $function($val, $args);
                }

                if ($valid === FALSE) {
                    $this->registerError($rule, $key);

                    $this->rules = array();  // reset rules
                    $this->filters = array();
                    return FALSE;
                }
            }
        }

        $this->validData[$key] = $val;
        return TRUE;
    }
205276
public function remove($key)
    {
        $parts = explode('.', $key);
        $scope = &$this->array;
        $count = count($parts) - 1;
        for ($i = 0; $i < $count; $i++) {
            if (!isset($scope[$parts[$i]])) {
                return;
            }
            $scope = &$scope[$parts[$i]];
        }
        unset($scope[$parts[$i]]);
    }
1238195
private function validate($key, $value) {
    if ($this->keyValidation) {
      $cb = $this->keyValidation;
      $cb($key);
    }
    if ($this->valueValidation) {
      $cb = $this->valueValidation;
      $cb($value);
    }
  }
212273
public static function input($key)
    {
        $request = new Request();
        if ($request->isGet() || $request->isHead()) {
            $string = $request->getQuery($key);
        } elseif ($request->isPost()) {
            $string = $request->getPost($key);
        } elseif ($request->isPatch()) {
            $string = $request->getPatch($key);
        } elseif ($request->isPut()) {
            $string = $request->getPut($key);
        } elseif ($request->isDelete()) {
            $string = $request->getDelete($key);
        } elseif ($request->hasFiles()) {
            $string = $request->getFiles($key);
        } else {
            parse_str(file_get_contents('php://input'), $_STR);
            $string = $_STR[$key];
        }

        return (isset($string) && !empty($string)) ? $string : false;
    }
1183733
public function delete($key, $scope = null)
    {
        if ($scope === null) {
            $scope = $this->getScope();
        }

        return $this->getContainer()->delete($key, $scope);
    }
809792
private function encryptBlock($input, $key)
    {
        if (!$input && !$key) {
            return '';
        }

        $this->prepareCipher($key);
        $result = mcrypt_generic($this->mcrypt, $input);
        mcrypt_generic_deinit($this->mcrypt);

        return $result;
    }
1317665
private function validateInput($haystack, $keys)
    {
        if (!is_array($haystack) || empty($haystack)) {
            throw new \InvalidArgumentException(
                "Provided input array is either empty or not an array."
            );
        }
        if (!is_array($keys) || empty($keys)) {
            throw new \InvalidArgumentException(
                "Provided input keys argument is either empty or not an array."
            );
        }
    }
538472
protected function renderInput($key, array $input)
    {
        $html = '';
        switch ($input[ 'type' ]) {
            case 'label':
                $html .= $this->form_label($key);

                break;
            case 'legend':
                $html .= $this->form_legend($key);

                break;
            case 'select':
                $html .= $this->form_select($key);

                break;
            case 'textarea':
                $html .= $this->form_textarea($key);

                break;
            case 'group':
                $html .= $this->form_group($key);

                break;
            case 'html':
                $html .= $this->form_html($key);

                break;
            default:
                if (in_array($input[ 'type' ], $this->typeInputBasic)) {
                    $html .= $this->form_input($key);
                }
        }

        return $html;
    }
1065056
protected function get_validation_var( $key, $post_array ) {
		return $this->app->utility->array_get( $post_array, $this->get_post_field_name( $key ) );
	}