Compile Some Rule

[same:value] Check that the field contents are equal to the mask value

@param string $key
@param string $masque

@return void
557626
protected function compileSame($key, $masque)
    {
        if (!preg_match("/^same:(.+)$/", $masque, $match)) {
            return;
        }

        $value = (string) end($match);

        if ($this->inputs[$key] == $value) {
            return;
        }

        $this->last_message = $this->lexique('same', [
            'attribute' => $key,
            'value' => $value
        ]);

        $this->fails = true;
        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
544226
public function remove(string $key): void
    {
        if (isset($this->orgData[$key])) {
            if (isset($this->updateAttributes[$key])) {
                unset($this->updateAttributes[$key]);
            }
        } else {
            if (isset($this->addAttributes[$key])) {
                unset($this->addAttributes[$key]);
            }
        }
        $this->removeAttributes[$key] = 0;
    }
132250
public static function check($key)
    {
        if (!self::_tableExists()) {
            return;
        }

        self::autoLoad();
        $model = self::model();

        if (key_exists($key, self::$_data)) {
            return true;
        }

        $query = $model->findByName($key);

        if (!$query->Count()) {
            return false;
        }

        return true;
    }
1231802
protected function isOneVoidValue($key, $rule = 'required_with')
    {
        $fields  = $this->getParamField($this->rules[ $key ], $rule);
        $require = new Rules\Required;

        foreach ($fields as $field) {
            if (!isset($this->inputs[ $field ])) {
                throw new \InvalidArgumentException(htmlspecialchars(
                    "The provided $field field does not exist."
                ));
            }
            $require->execute('required', $field, $this->inputs[ $field ], false, true);
            if ($require->hasErrors()) {
                return true;
            }
        }

        return false;
    }
1351541
private function isExclude(string $key): bool
    {
        if (!empty($this->excludes) && in_array($key, $this->excludes, true)) {
            return true;
        }

        if (!empty($this->only) && !in_array($key, $this->only, true)) {
            return true;
        }

        return false;
    }
978365
public function setMetadata($key, $value)
    {
        if (is_null($this->metadataCache))
        {
            $this->metadataCache = [];
        }

        $this->metadataCache[$key] = $value;
    }
648313
public function setCacheKey($key)
    {
        $key = preg_replace('/[^\da-z]/i', '', $key);
        if (!empty($key)) {
            $this->cacheKey = $key;
        }
    }
601684
protected function runUrl($key, $datas, $rule)
    {
        $data = $datas[$key];

        if (!filter_var($data, FILTER_SANITIZE_URL)) {
            $this->fails[] = $messageKey = "url.$key";

            $this->addMessage($key, $rule, $messageKey);
        }
    }
1190199
private function _match($key, $value, $filter)
    {
        if ($this->scanKeys) {
            if ($filter->match($key)) {
                return true;
            }
        }

        if ($filter->match($value)) {
            return true;
        }

        return false;
    }
1162148
public function set($key, $value)
    {
        $this->nestedKeyCache = [];

        if ($this->isNestedKey($key)) {
            $this->setNestedValueByKey($key, $value);

            return;
        }

        $this->items[$key] = $value;
    }
603430
public function validate(string $key, array $scope = [], array $input = []): void
    {
        $value = $key == '*' ? '*' : $scope[$key] ?? null;

        ($this->validate)($value, $key, $scope, $input);
    }
678501
public static function validateKey($key): void
    {
        if (!is_string($key)) {
            throw new InvalidArgumentException(sprintf(
                'Cache key must be string, "%s" given',
                is_object($key) ? get_class($key) : gettype($key)
            ));
        }
        if (!isset($key[0])) {
            throw new InvalidArgumentException('Cache key length must be greater than zero');
        }
        if (isset($key[strcspn($key, '{}()/\@:')])) {
            throw new InvalidArgumentException(sprintf('Cache key "%s" contains reserved characters {}()/\@:', $key));
        }
    }
841993
protected function compileFloat($key, $masque)
    {
        if (!preg_match("/^float$/", $masque, $match)) {
            return;
        }

        if (is_float($this->inputs[$key])) {
            return;
        }

        $this->last_message = $this->lexique('float', $key);

        $this->fails = true;

        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
101834
protected function compileMin($key, $masque)
    {
        if (!preg_match("/^min:(\d+)$/", $masque, $match)) {
            return;
        }

        $length = (int) end($match);

        if (Str::len($this->inputs[$key]) > $length) {
            return;
        }

        $this->fails = true;
        
        $this->last_message = $this->lexique('min', [
            'attribute' => $key,
            'length' => $length
        ]);

        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
686173
protected function compileEmpty($key, $masque)
    {
        if (!isset($this->inputs[$key])) {
            $this->fails = true;

            $this->last_message = $message = $this->lexique('empty', $key);

            $this->errors[$key][] = [
                "masque" => $masque,
                "message" => $message
            ];
        }
    }
905642
public static function set($error, $key = null)
    {
        if ($key) {
            static::$error[$key][] = $error;
        } else {
            static::$error[] = $error;
        }
    }
555903
protected function normalizeKey(&$key)
    {
        $key = (string)$key;

        if ($key === '') {
            throw new InvalidArgumentException("An empty key isn't allowed");
        } elseif (($p = $this->getOptions()->getKeyPattern()) && !preg_match($p, $key)) {
            throw new InvalidArgumentException(
                "The key '{$key}' doesn't match against pattern '{$p}'"
            );
        }
    }