Compile Alpha Rule

[alpha] Check that the field content is an alpha

@param string $key
@param string $masque

@return void
327786
protected function compileAlpha($key, $masque)
    {
        if (!preg_match("/^alpha$/", $masque)) {
            return;
        }

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

        $this->last_message = $this->lexique('alpha', $key);
        
        $this->fails = true;
        
        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
1103918
protected function addRule($key, $rules)
    {
        if ($this->shouldSanitize($key)) {
            throw new InvalidArgumentException(sprintf(
                'Sanitation rules are already defined for field [%s]', $key
            ));
        }

        $this->rules[$key] = $this->buildRules($rules);
    }
149336
protected function maybeRunValidationKeyRules($key)
    {
        if (($key & $this->transactionType) !== $this->transactionType) {
            return;
        }

        foreach ($this->validations->rules[$key] as $validation) {
            if (null === $validation->clause) {
                continue;
            }

            if ($this->transactionModifier === $validation->modifier
                && !call_user_func($validation->clause->callback, $this)
            ) {
                throw new BuilderException($validation->clause->message);
            }
        }
    }
292064
protected function runDate($key, $datas, $rule)
    {
        if (false === strtotime($datas[$key])) {
            $this->fails[] = $messageKey = "date.$key";

            $this->addMessage($key, $rule, $messageKey);
        }
    }
524448
protected function isAlphaNumeric($key) : bool
    {
        $conCate = ' ';
        $columnName = ucfirst($this->convertToFieldName($key)).' should be ';

        if (isset($this->errors[$key.self::ERROR])) {
            list($conCate, $columnName) = $this->setErrorConcat($key);
        }

        if (!ctype_alnum($this->param[$key])) {
            return $this->setAlphaNumError($key, $conCate, $columnName, 'alpha numeric.');
        }

        return true;
    }
1078004
protected function validateKey(/*# string */ &$key)
    {
        // validate key
        if (is_string($key)) {
            $key = trim($key);
            return;
        }

        // throw exception
        throw new InvalidArgumentException(
            Message::get(Message::CACHE_INVALID_KEY, $key),
            Message::CACHE_INVALID_KEY
        );
    }
462958
private function validateInput($input, $rules, $key)
    {
        if (isset($input[$key]) && isset($rules[$key])) {
            $ruleExp = explode('|', $rules[$key]);

            foreach ($ruleExp as $rule) {
                $this->parseRule($rule, $input, $key);
            }
        }
    }
618518
public function compileMetadata()
    {
        if (is_null($this->metadataCache))
        {
            $this->metadata = '{}';

            return;
        }

        $this->metadata = json_encode($this->metadataCache);
    }
1238195
private function validate($key, $value) {
    if ($this->keyValidation) {
      $cb = $this->keyValidation;
      $cb($key);
    }
    if ($this->valueValidation) {
      $cb = $this->valueValidation;
      $cb($value);
    }
  }
904658
protected function compileEmail($key, $masque)
    {
        if (!preg_match("/^email$/", $masque, $match)) {
            return;
        }

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

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

        $this->fails = true;
        
        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
423201
protected function compileLower($key, $masque)
    {
        if (!preg_match("/^lower/", $masque)) {
            return;
        }

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

        $this->fails = true;
        
        $this->last_message = $this->lexique('lower', $key);

        $this->errors[$key][] = [
            "masque" => $masque,
            "message" => $this->last_message
        ];
    }
1159643
public function remove( $selector, $key ){
		$rule	= $this->getRuleBySelector( $selector );
		if( !$rule )
			return FALSE;
		if( $rule->removePropertyByKey( $key ) ){
			if( !$rule->getProperties() )
				$this->removeRuleBySelector( $selector );
			return TRUE;
		}
		return FALSE;
	}
225299
protected function validateKey($key)
    {
        if (!is_string($key)) {
            throw new CacheKeyException("Cache key must be a string, " . gettype($key) . " given");
        }

        if (preg_match("/[^A-Za-z0-9\._-]/", $key)) {
            throw new CacheKeyException("Cache key contains invalid characters: {$key}");
        }

        if (strlen($key) > 64) {
            throw new CacheKeyException("Cache key cannot be longer than 64 characters: {$key}");
        }
    }
1355290
public function compilePattern($key) {
		$items = $this->patterns[$key];
		if (is_array($items)) {
			$items = implode(null, $items);
		}
		return String::insert($items, $this->regexInject);
	}
347569
function (key, styles) {
    key = camelToKebab(key)
    let stylesText = ''
    for (const k in styles) {
      if (styles.hasOwnProperty(k)) {
        stylesText += camelToKebab(k) + ':' + styles[k] + ';'
      }
    }
    const styleText = `@${key}{${stylesText}}`
    appendCss(styleText, 'dom-added-rules')
  }
663940
public function useKeyAsIndex($key, $normalize = false)
    {
        if (null === $key) {
            $this->indexKey = null;
            return;
        }

        if (true !== $normalize && !$this->isValidNodeName($key)) {
            throw new \InvalidArgumentException(sprintf('%s is an invalid node name', $key));
        }

        $this->indexKey = $normalize ? $this->normalizer->normalize($key) : $key;
    }
860918
protected function runTableExists($key, $datas, $rule)
    {
        $data = $datas[$key];

        $advanced = Database::table($data)->tableExists();

        if (!$advanced->isSuccess()) {
            $this->fails[] = $messageKey = "$rule.$key";

            $this->addMessage($key, $rule, $messageKey);
        }
    }