Parse the default the value

@since 2.0.0

@param        $value
@param string $type
@param null   $name
@param null   $options
@param null   $pod
@param null   $id

@return mixed|void
778857
public static function default_value( $value, $type = 'text', $name = null, $options = null, $pod = null, $id = null ) {

		$default_value = pods_v( 'default_value', $options );

		if ( '' === $default_value || null === $default_value ) {
			$default_value = $value;
		}

		$default = pods_v( 'default', $options, $default_value, true );

		if ( is_string( $default ) ) {
			$default_value = str_replace( array( '{@', '}' ), '', trim( $default ) );
		}

		if ( $default != $default_value && 1 == (int) pods_v( 'default_evaluate_tags', $options, 1 ) ) {
			$default = pods_evaluate_tags( $default );
		}

		$default = pods_v( pods_v( 'default_value_parameter', $options ), 'request', $default, true );

		if ( $default != $value ) {
			$value = $default;
		}

		if ( is_array( $value ) ) {
			$value = pods_serial_comma( $value );
		}

		return apply_filters( 'pods_form_field_default_value', $value, $default, $type, $options, $pod, $id );
	}
345616
protected function validateType($value, $type, $name)
    {
        if (empty($type) || $type === 'mixed') {
            return;
        }

        if (isset($this->typeMap[$type])) {
            $test = 'is_' . $this->typeMap[$type];

            if (!call_user_func($test, $value)) {
                $givenType = gettype($value);

                throw new RuntimeException("Expected property '{$name}' to be a '{$type}'. '{$givenType}' given.");
            }

            return;
        }

        if (class_exists($type)) {
            if (!($value instanceof $type)) {
                $givenType = gettype($value);

                throw new RuntimeException("Expected property '{$name}' to be a '{$type}'. '{$givenType}' given.");
            }

            return;
        }

        throw new LogicException("Unrecognized type '{$type}' for property '{$name}'");
    }
1230667
public function param($param, $value, $type = null)
    {
        return $this->setParameter($param, $value, $type);
    }
1218867
protected function _setParameter($type, $name, $value)
    {
        $parray = array();
        $type = strtolower($type);
        switch ($type) {
            case 'get':
                $parray = &$this->paramsGet;
                break;
            case 'post':
                $parray = &$this->paramsPost;
                break;
        }

        if ($value === null) {
            if (isset($parray[$name])) unset($parray[$name]);
        } else {
            $parray[$name] = $value;
        }
    }
878077
public function parse($value, $type = NULL, &$position = NULL, $fmt, $value, $type = NULL, &$position = NULL)
    {
    }
802375
public static function data( $data, $name = null, $type = null, $options = null ) {

		$data = (array) apply_filters( "pods_form_ui_field_{$type}_data", $data, $name, $options );

		foreach ( $data as $key => $value ) {
			if ( null === $value ) {
				continue;
			}

			$key = sanitize_title( $key );

			if ( is_array( $value ) ) {
				$value = implode( ',', $value );
			}

			echo ' data-' . esc_attr( (string) $key ) . '="' . esc_attr( (string) $value ) . '"';
		}
	}
575306
public function input($type = null, $name = null, $value = null)
    {
        $hasValue = $name && (! is_null($this->old($name, $value)) || ! is_null($value));

        return Input::create()
            ->attributeIf($type, 'type', $type)
            ->attributeIf($name, 'name', $this->fieldName($name))
            ->attributeIf($name, 'id', $this->fieldName($name))
            ->attributeIf($hasValue, 'value', $this->old($name, $value));
    }
454981
protected function generateDefault( $type, $value )
    {
        switch ( $type )
        {
            case 'boolean':
                return ( $value && $value != 'false' ) ? 'true' : 'false';

            case 'integer':
                return (int) $value;

            case 'float':
            case 'decimal':
                return (float) $value;

            case 'timestamp':
                return (int) $value;

            default:
                return "'$value'";
        }
    }
1232005
private function cast($value, $type)
    {
        switch ($type) {
            case 'bool':
                return boolval($value);
                break;
            case 'int':
                return intval($value);
                break;
            case 'float':
                return floatval($value);
                break;
            case 'string':
                return $value;
                break;
            case 'array':
                if (is_array($value)) {
                    return serialize($value);
                } else {
                    return unserialize($value);
                }
                break;
            default:
                return $value;
        }
    }
780011
public static function processSingleColumnType($column_name, $column_options, $value, $options = []) {
		// we need to fix default
		if (isset($column_options['default'])) {
			foreach (['dependent::', 'parent::', 'master_object::', 'static::'] as $v) {
				if (strpos($column_options['default'] . '', $v) !== false) {
					unset($column_options['default']);
					break;
				}
			}
		}
		$result = [];
		// processing as per different data types
		if ($column_options['type'] == 'boolean') { // booleans
			$result[$column_name] = !empty($value) ? 1 : 0;
		} else if (in_array($column_options['type'], ['smallserial', 'serial', 'bigserial'])) {
			if (\Format::readIntval($value, ['valid_check' => 1])) {
				$temp = \Format::readIntval($value);
				if ($temp !== 0) {
					$result[$column_name] = $temp;
				}
			} else {
				$result[$column_name . '_is_serial_error'] = true;
			}
			$result[$column_name . '_is_serial'] = true;
		} else if (in_array($column_options['type'], ['smallint', 'integer', 'bigint'])) { // integers
			// if we got empty string we say its null
			if (is_string($value) &&  $value === '') {
				$value = null;
			}
			if (is_null($value)) {
				if (!empty($column_options['null']) || !empty($options['ignore_defaults'])) {
					$result[$column_name] = null;
				} else {
					$result[$column_name] = $column_options['default'] ?? 0;
				}
			} else {
				$result[$column_name] = \Format::readIntval($value);
			}
		} else if (in_array($column_options['type'], ['numeric', 'bcnumeric'])) { // numerics as floats or strings
			// if we got empty string we say its null
			if (is_string($value) &&  $value === '') {
				$value = null;
			}
			if (is_null($value)) {
				if (!empty($column_options['null']) || !empty($options['ignore_defaults'])) {
					$result[$column_name] = null;
				} else {
					$result[$column_name] = $column_options['default'] ?? ($column_options['type'] == 'bcnumeric' ? '0' : 0);
				}
			} else {
				$result[$column_name] = \Format::readFloatval($value, ['bcnumeric' => $column_options['type'] == 'bcnumeric']);
			}
		} else if (in_array($column_options['type'], ['date', 'time', 'datetime', 'timestamp'])) {
			$result[$column_name] = \Format::readDate($value, $column_options['type']);
			// for datetime we do additional processing
			if (!empty($options['process_datetime'])) {
				$result[$column_name . '_strtotime_value'] = 0;
				if (!empty($value)) {
					$result[$column_name . '_strtotime_value'] = strtotime($result[$column_name]);
				}
			}
		} else if ($column_options['type'] == 'json') {
			if (!is_json($value)) {
				$result[$column_name] = json_encode($value);
			} else {
				$result[$column_name] = $value;
			}
		} else if ($column_options['type'] == 'mixed') {
			$result[$column_name] = $value;
		} else {
			if (is_null($value)) {
				$result[$column_name] = null;
			} else {
				// we need to convert numeric strings
				if (($column_options['format'] ?? '') == 'id') {
					$result[$column_name] = \Format::numberToFromNativeLanguage($value, [], true);
				} else {
					$result[$column_name] = (string) $value;
				}
			}
		}
		return $result;
	}
663814
protected function checkType($value, $type, $nullable = false)
    {
        if (gettype($value) === $type) {
            return true;
        }
        return $nullable && null === $value;
    }
67778
public static function checkType($name, $type, $value) {
    $given_type = self::getType($value);
    if ($given_type !== $type) {
      $value = $value instanceof Atom ? $value->toJson() : json_encode($value);
      throw new \UnexpectedValueException("`$value` should be a `$type` not `$given_type`. If you're decoding JSON, make sure you're using valid JSON.");
    }
  }
913315
public static function decode(string $value, string $type = null)
    {
        return self::run(self::DECODER, $value, $type);
    }
787295
protected function convert ($type, $value)
		{
			switch ($type)
			{
				case 'string':
					return (string) $value;

				case 'number':
					return is_float($value)
						? (float) $value
						: (int) $value;

				case 'boolean':
					return $value === true || $value === 'true' || $value === '1' || $value === 'on';

				default:
					if (is_float($value))
					{
						return $this->convert('number', $value);
					}
					if (is_numeric($value))
					{
						return strpos($value, '.') !== FALSE
							? (float) $value
							: (int) $value;
					}
					if ($value === 'true' || $value === 'false')
					{
						return $value === 'true';
					}
					if ($value === '')
					{
						return null;
					}
			}
			return $value;
		}
1024245
private function parseValue($value, $types, \ReflectionProperty $property, $object)
    {
        foreach ($types as $type) {
            foreach ($this->context->getParsers() as $parser) {
                if ($parser instanceof ValueParserInterface) {
                    if (is_array($value) && strpos($type, '[]') !== false) {
                        foreach ($value as $key => &$arrayValue) {
                            $arrayValue = $parser->toArrayValue($arrayValue, str_replace('[]', null, $type), $property, $arrayValue);
                        }
                    } else {
                        $value = $parser->toArrayValue($value, $type, $property, $object);
                    }
                } else {
                    throw new \InvalidArgumentException(sprintf('%s is not a valid parser.', get_class($parser)));
                }
            }
        }

        return $value;
    }
134425
public function input($type, $name, $value = '', $options = [])
    {
        if (!isset($options['id'])) {
            $options['id'] = $name;
        }

        if (!empty($value)) {
            $options['value'] = $value;
        }

        $options['type'] = $type;
        $options['name'] = $name;

        return '<input'.$this->attributes($options).'>';
    }
275662
protected function _setParameter($type, $name, $value)
    {
        $parray = array();
        $type = strtolower($type);
        switch ($type) {
            case 'get':
                $parray = &$this->paramsGet;
                break;
            case 'post':
                $parray = &$this->paramsPost;
                if ( $value === null ) {
                    if (isset($this->body_field_order[$name]))
                        unset($this->body_field_order[$name]);
                } else {
                    $this->body_field_order[$name] = self::VTYPE_SCALAR;
                }
                break;
        }

        if ($value === null) {
            if (isset($parray[$name])) unset($parray[$name]);
        } else {
            $parray[$name] = $value;
        }
    }