Validates field name

@param string $field

@return string
@throws \InvalidArgumentException
558401
public function validateFieldName($field)
    {
        if (!$field || $field != lcfirst(preg_replace('/[^a-zA-Z]+/', '', $field))) {
            throw $this->getException(
                'The parameter isn\'t valid ("%s" given, expecting camelcase separated words)',
                [$field]
            );
        }

        if (in_array(strtolower($field), $this->getReservedKeywords())) {
            throw $this->getException('"%s" is a reserved word.', [$field]);
        }

        return $field;
    }
189617
protected static function filter($field)
    {
        $field = preg_replace('/[\.\/\\:;,?$*!#_-]/', '', $field);
        $field = preg_replace('/\s+/', ' ', trim($field));
        return $field;
    }
1068834
public function getUploadFieldName($field = null)
    {
        if (!is_null($field)) {
            return $field;
        }

        $imagesFields = $this->getDefinedUploadFields();
        $fieldKey = array_first(array_keys($imagesFields));

        // return first field name
        return is_int($fieldKey)
            ? $imagesFields[$fieldKey]
            : $fieldKey;
    }
342981
protected static function validateFieldName($name)
    {
        $fields = self::getFields();
        if (!in_array($name, $fields)) {
            $names = implode(', ', $fields);
            throw new LaravelSmsException("Illegal field `$name`, the field name must be one of $names.");
        }
    }
972844
public function map(Field $field)
    {
        if (is_numeric($field->value)) {
            $date = new DateTime("@{$field->value}");
        } else {
            try {
                $date = new DateTime($field->value);
            } catch (Exception $e) {
                throw new InvalidArgumentException('Invalid date provided: ' . $field->value);
            }
        }

        return $date->format('Y-m-d\\TH:i:s\\Z');
    }
25766
public function validateField(Field $field)
    {
        if (false === $this->fieldWasValidated($field)) {
            $this->checkFieldActivation($field);

            if (false === $this->result->fieldIsDeactivated($field)) {
                $this->markFieldAsValidated($field);

                // Looping on the field's validation settings...
                foreach ($field->getValidation() as $validation) {
                    if ($this->result->validationIsDeactivated($validation)) {
                        continue;
                    }

                    $validatorResult = $this->processFieldValidation($field, $validation);

                    // Breaking the loop if an error occurred: we stop the validation process for the current field.
                    if ($validatorResult->hasErrors()) {
                        break;
                    }
                }
            }
        }
    }
762333
public function getNameField( $key )
	{
		if( !array_key_exists( $key, $this->types['n'] ) )
			throw new InvalidArgumentException( 'Name Key "'.$key.'" is invalid.' );
		return $this->types['n'][$key];
	}
725505
public static function quoteFieldNames($fields)
    {
        $fieldArr = is_string($fields) ? explode(',', trim($fields)) : (array)$fields;
        
        foreach ($fieldArr as $k => $field) {
            $field = preg_replace("/(\s+)/", ' ', trim($field));
            if ($field == '*') {
                // do nothing
            } elseif (false !== strpos($field, '(')) {
                if (preg_match("/(.*?)\\((.*?)\\)(.*)/i", $field, $match)) {
                    // xx() | xx(xx) | xx(xx)xx
                    $field = $match[1] . '(' . QueryBuilder::quoteFieldName($match[2]).')' . QueryBuilder::quoteFieldName($match[3]);
                } else {
                    // xx( | xx(xx
                    $field = preg_replace_callback(
                        "/\\((.+)/i",
                        function($match) {
                            return '('.QueryBuilder::quoteFieldName($match[1]);
                        },
                        $field
                    );
                }

                $fieldArr[$k] = $field;
            } elseif (false !== strpos($field, ')')) {
                // xx)
                $field = preg_replace_callback(
                    "/(.*)\\)/i",
                    function($match) {
                        return QueryBuilder::quoteFieldName($match[1]) . ')';
                    },
                    $field
                );
                
                $fieldArr[$k] = QueryBuilder::quoteFieldName(substr($field, 0, strlen($field) - 1)) . ')';
            } else {
                $fieldArr[$k] = QueryBuilder::quoteFieldName($field);
            }
        }
        
        $rFields = implode(',', $fieldArr);        
        
        return $rFields;
    }
528182
public function validate(Validation $validation, $field) : bool
    {
        if (!is_string($field)) {
            throw new Exception(
                "Field name must be a string"
            );
        }



        $label = $this->getOption("label");

        if (empty($label)) {
            $label = $validation->getLabel($field);
        }



        $value = $validation->getValue($field);

        if ($this->isSetOption("allowEmpty") && empty($value)) {
            return true;
        }



        if (!preg_match('/^[a-zA-Z0-9\-]+$/i', $value)) {
            $message = $this->getOption("message");

            if (empty($message)) {
                $message = "Field :field is not in a valid slug format";
            }



            $replacePairs = [
                ":field" => $label,
            ];

            $validation->appendMessage(
                new Message(
                    strtr($message, $replacePairs),
                    $field,
                    "Slug"
                )
            );

            return false;
        }

        return true;
    }
106033
protected function processField($field)
    {
        $javaScriptCode = [];
        $fieldName = $field->getName();

        foreach ($field->getValidation() as $validationName => $validationConfiguration) {
            $validatorClassName = $validationConfiguration->getClassName();

            if (in_array(AbstractValidator::class, class_parents($validatorClassName))) {
                $javaScriptCode[] = (string)$this->getInlineJavaScriptValidationCode($field, $validationName, $validationConfiguration);
            }
        }

        $javaScriptCode = implode(CRLF, $javaScriptCode);
        $javaScriptFieldName = GeneralUtility::quoteJSvalue($fieldName);

        return <<<JS
            /***************************
            * Field: "$fieldName"
            ****************************/
            field = form.getFieldByName($javaScriptFieldName);

            if (null !== field) {
$javaScriptCode
            }

JS;
    }
628636
public function getFieldType($field)
    {
        $definition = $this->getFieldDefinition($field);
        if ($definition && isset($definition['type'])) {
            return $definition['type'];
        }
    }
56476
private function validate($field)
    {
        //====================================================================//
        // Verify - Field Type is Not Empty
        if (empty($field->type) || !is_string($field->type)) {
            return Splash::log()->err("ErrFieldsNoType");
        }
        //====================================================================//
        // Verify - Field Id is Not Empty
        if (empty($field->id) || !is_string($field->id)) {
            return Splash::log()->err("ErrFieldsNoId");
        }
        //====================================================================//
        // Verify - Field Id No Spacial Chars
        if ($field->id !== preg_replace('/[^a-zA-Z0-9-_@]/u', '', $field->id)) {
            Splash::log()->war("ErrFieldsInvalidId", $field->id);

            return false;
        }
        //====================================================================//
        // Verify - Field Name is Not Empty
        if (empty($field->name) || !is_string($field->name)) {
            return Splash::log()->err("ErrFieldsNoName");
        }
        //====================================================================//
        // Verify - Field Desc is Not Empty
        if (empty($field->desc) || !is_string($field->desc)) {
            return Splash::log()->err("ErrFieldsNoDesc");
        }

        return true;
    }
941043
function Field($name)
    {
        if (!array_key_exists($name, $this->fields))
            throw new \InvalidArgumentException($name . ' is not a valid field for '. $this->name);
        
        return $this->fields[$name];
    }
1355663
protected function computeHydrateFieldName($field)
    {
        if ($this->hasNamingStrategy()) {
            $field = $this->getNamingStrategy()->hydrate($field);
        }
        return $field;
    }
176192
private function getFieldType($field): ?string
    {
        if ($field === null) {
            return null;
        }

        $fieldType = gettype($field);
        if ($fieldType === 'object') {
            $classNameArray = explode('\\', get_class($field));
            if (count($classNameArray) === 0) {
                return null;
            }

            $fieldType = mb_strtolower($classNameArray[count($classNameArray) - 1]);
        }

        return $fieldType;
    }
46846
protected function get_field($field) {
        $fieldname = calculator::using_attempts_string_id($this->whichattempts).$field;
        return $this->{$fieldname};
    }
286895
public function findFilter($field)
	{
		$filters = $this->getFilters();

		//return either the Field object or throw an InvalidArgumentException
		if (!isset($filters[$field]))
		{
			throw new \InvalidArgumentException("The " . $field . " filter does not exist on the " . $this->config->getOption('name') . " model");
		}

		return $filters[$field];
	}