Complete field default value from argument and property

@param Input $field
@param ReflectionParameter $param
@param string $fieldName
964741
private function completeFieldDefaultValue(Input $field, ReflectionParameter $param, string $fieldName): void
    {
        if (!$field->hasDefaultValue() && $param->isDefaultValueAvailable()) {
            $field->setDefaultValue($param->getDefaultValue());
        }

        if (!$field->hasDefaultValue()) {
            $defaultValue = $this->getPropertyDefaultValue($fieldName);
            if ($defaultValue !== null) {
                $field->setDefaultValue($defaultValue);
            }
        }
    }
355014
protected function paramDetails(\ReflectionParameter $param) {
        return ' ' . ($param->isOptional() ? '[' : '') . '--' . $param->getName() . ($param->isOptional() ? '=' . ($param->isDefaultValueConstant() ? $param->getDefaultValueConstantName() : '"' . $param->getDefaultValue() . '"') : '') . ($param->isOptional() ? ']' : '');
    }
660756
public function edit_field_set_default($mform) {
        $key = $this->field->defaultdata;
        if (isset($this->options[$key]) || ($key = array_search($key, $this->options)) !== false){
            $defaultkey = $key;
        } else {
            $defaultkey = '';
        }
        $mform->setDefault($this->inputname, $defaultkey);
    }
985774
protected function validate_valid_ipv4($field, $input, $param = null)
    {
        if (!isset($input[$field]) || empty($input[$field])) {
            return;
        }

        if (!filter_var($input[$field], FILTER_VALIDATE_IP, FILTER_FLAG_IPV4)) {
            // removed !== FALSE

            return array(
                'field' => $field,
                'value' => $input[$field],
                'rule' => __FUNCTION__,
                'param' => $param,
            );
        }
    }
527138
public function validated($field = null, $default = false)
	{
		if ($field === null)
		{
			return $this->validated;
		}

		return array_key_exists($field, $this->validated) ? $this->validated[$field] : $default;
	}
1058995
private function completeFieldType(Field $field, ReflectionMethod $method, string $fieldName, DocBlockReader $docBlock): void
    {
        if ($this->isIdentityField($fieldName)) {
            $field->type = Type::nonNull(Type::id());
        }

        // If still no type, look for docBlock
        if (!$field->type) {
            $field->type = $this->getTypeFromDocBock($method, $docBlock);
        }

        // If still no type, look for type hint
        if (!$field->type) {
            $field->type = $this->getTypeFromReturnTypeHint($method, $fieldName);
        }

        // If still no type, cannot continue
        if (!$field->type) {
            throw new Exception('Could not find type for method ' . $this->getMethodFullName($method) . '. Either type hint the return value, or specify the type with `@API\Field` annotation.');
        }
    }
1029677
public function fillModel(&$model, $input)
    {
        $model->{$this->getOption('field_name')} = is_null($input) || $input === '' ? null : $this->parseNumber($input);
    }
1184982
private function validateFieldName($field)
    {
        $fieldName = $field->getName();
        if (!$fieldName || $this->fieldNameExists($fieldName)) {
            throw new FieldNameCollisionException("Field Name: `{$fieldName}` already exists.");
        }

        return true;
    }
936126
function autovalue($fieldname, $default = null) {
		if ($this->autocomplete !== null) {
			$fieldname = rtrim($fieldname, '[]');
			if (isset($this->autocomplete[$fieldname])) {
				return $this->autocomplete[$fieldname];
			}
		}

		// no auto complete value found
		return $default;
	}
603220
public function setFieldParam(string $field, string $key, string $value): self
    {
        if (!isset($this->_params[$field])) {
            $this->_params[$field] = [];
        }

        $this->_params[$field][$key] = $value;

        return $this;
    }
834300
public function SetFormValue($FieldName, $Value = NULL) {
      $this->FormValues();
      if (is_array($FieldName))
         $this->_FormValues = array_merge($this->_FormValues, $FieldName);
      else
         $this->_FormValues[$FieldName] = $Value;
   }
1275807
public static function setValueFromPost(&$param, $defaultValue = '', $scope = null)
    {
        if (isset($_POST)) {
            $array = $_POST;
        } else {
            $array = [];
        }
        self::setValue($param, $array, $defaultValue, $scope);
    }
741952
public function input($fieldName, $options = array()) {
		$this->_inputType = null;
		$this->_fieldName = $fieldName;
		$options = $this->_initInputOptions($options);

		return parent::input($fieldName, $options);
	}
85720
protected function validate_required($field, $input, $param = null)
    {
        if (isset($input[$field]) && ($input[$field] === false || $input[$field] === 0 || $input[$field] === 0.0 || $input[$field] === '0' || !empty($input[$field]))) {
            return;
        }

        return array(
            'field' => $field,
            'value' => null,
            'rule' => __FUNCTION__,
            'param' => $param,
        );
    }
1251486
public function input($field, $value = null, array $attributes = array())
	{
		if (is_array($field))
		{
			$attributes = $field;
			! array_key_exists('value', $attributes) and $attributes['value'] = '';
		}
		else
		{
			$attributes['name'] = (string) $field;
			$attributes['value'] = (string) $value;
		}

		$attributes['type'] = empty($attributes['type']) ? 'text' : $attributes['type'];

		if ( ! in_array($attributes['type'], static::$_valid_inputs))
		{
			throw new \InvalidArgumentException(sprintf('"%s" is not a valid input type.', $attributes['type']));
		}

		if ($this->get_config('prep_value', true) && empty($attributes['dont_prep']))
		{
			$attributes['value'] = $this->prep_value($attributes['value']);
		}
		unset($attributes['dont_prep']);

		if (empty($attributes['id']) && $this->get_config('auto_id', false) == true)
		{
			$attributes['id'] = $this->get_config('auto_id_prefix', 'form_').$attributes['name'];
		}

		$tag = ! empty($attributes['tag']) ? $attributes['tag'] : 'input';
		unset($attributes['tag']);

		return html_tag($tag, $this->attr_to_string($attributes));
	}
1087303
public static function createDefaultField($fieldName, $fieldConfig)
    {
        /** @var UserField $fieldType */
        $fieldType = $fieldConfig['FieldType'];

        $field = $fieldType::create();
        $field->Name = $fieldName;
        if (is_array($fieldConfig)) {
            foreach ($fieldConfig as $property => $value) {
                $field->setField($property, $value);
            }
        }

        return $field;
    }
256780
protected function _getUpdateFieldValue($fieldName, $field)
    {
        $fieldValue = null;
        if ($field instanceof Field) {
            $fieldValue = $field->getRawValue();
        } elseif (isset($field->value)) {
            $fieldValue = $field->value;
        }

        $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        //Check if this field value is null AND it can be null according if not returning default value
        if ((null === $fieldValue)) {
            if ($this->_canFieldBeNull($fieldName)) {
                return 'null';
            } elseif ($fieldValue = $this->_getFieldDefaultValue($fieldName)) {
                return $database->quote($fieldValue);
            }
        }

        return $database->quote($fieldValue);
    }