@param $value

@return float|int|null|bool
14741
protected function getScalarValue($value)
    {
        switch ($value[self::SCALAR_TYPE]) {
            case 'integer':
                return \intval($value[self::SCALAR_VALUE]);
            case 'float':
                return \floatval($value[self::SCALAR_VALUE]);
            case 'boolean':
                return $value[self::SCALAR_VALUE];
            case 'NULL':
                return self::NULL_VAR;
        }

        return $value[self::SCALAR_VALUE];
    }
148225
protected function getValueDescription($value)
    {
        switch (true) {
            case (is_numeric($value)):
                $value = strval($value);
                break;

            case (is_bool($value) && $value):
                $value = '(boolean) true';
                break;

            case (is_bool($value) && !$value):
                $value = '(boolean) false';
                break;

            case (is_null($value)):
                $value = 'null value';
                break;

            default:
                break;
        }

        return $value;
    }
962231
protected function valueBool($value)
	{
		if ($value !== false && empty($value)) return Yii::$app->formatter->nullDisplay;
		return Yii::$app->formatter->asBoolean($value);
	}
554798
static public function parseValue($value) {
		$value = trim($value);
		
		if (is_numeric($value)) {
			$valueOrigin = $value;

			if (strpos($value, '.') === false) {
				$value = (int) $value;
			} else {
				$value = (float) $value;
			}

			// Overflow checking
			if ($valueOrigin !== (string) $value) {
				$value = $valueOrigin;
			}
		}
		
		return $value;
	}
636060
function Check($value)
    {
        $floatValue = 0.0;
        if (!GlobalNumberParser::TryParse($value, $floatValue)) {
            $this->error = self::NotParsed;
        }
        else {
            if (!$this->CheckMin($floatValue)) {
                 $this->error = self::ExceedsMin; 
            } else if (!$this->CheckMax($floatValue)) {
                $this->error = self::ExceedsMax;
            }
        }
        return $this->error == '';
    }
34764
public static function createFloat($value)
    {
        if ($value instanceof NumericTypeInterface) {
            return $value->asFloatType();
        }
        if (!is_numeric($value)) {
            throw new \InvalidArgumentException("'{$value}' is no valid numeric for FloatType");
        }
        
        if (self::getRequiredType() == self::TYPE_GMP) {
            return RationalTypeFactory::create($value);
        }
        
        return new FloatType($value);
    }
1080327
public static function integer($value){

		$value = static::_nullValue($value);

		if($value !== null){

			$value = (int) $value;
		}

		return $value;
	}
1016298
private function castValue(string $value)
    {
        $value = $this->normalize($value);
        if (\preg_match('/^[0-9]+$/', $value)) {
            $value = (int)$value;
        } elseif (\preg_match('/^[0-9\.]+$/', $value)) {
            $value = (float)$value;
        } elseif (\preg_match('/^true|false$/', $value)) {
            $value = $value === 'true' ? true : false;
        }
        return $value;
    }
1045058
public function apply($value)
    {
        if (is_int($value) || is_float($value)) {
            return $this->compare($value);
        } elseif (is_array($value)) {
            return $this->compare(count($value));
        } else {
            $value = (string) $value;

            return $this->compare(strlen($value));
        }
    }
829152
public function apply(Value $value): array
    {
        if ($value->isNull()) {
            return $this->null();
        }

        $float = $value->value();
        settype($float, 'float');
        if (empty($this->decimals)) {
            return $this->filtered($float);
        }

        return $this->filtered((int) ($float * pow(10, $this->decimals)));
    }
126769
private function getNumericValue(string $value)
    {
        if (\strpos($value, '.') !== false) {
            return (float) $value;
        }

        return (int) $value;
    }
920505
protected function _value($value)
    {
        if ($value === null) {
            return 'null';
        }
        if ($value === true) {
            return 'true';
        }
        if ($value === false) {
            return 'false';
        }

        return (string)$value;
    }
257927
private function convertInt($value)
    {
        if (!is_numeric($value)) {
            return $value;
        }

        if ((string) (int) $value !== (string) $value) {
            return $value;
        }

        return (int) $value;
    }
609888
protected function castValue($value)
    {
        if (is_null($value)) {
            return $value;
        }

        if ($this->isElementOfDate() && $this->isDateCastable()) {
            return $this->fromDateTime($value);
        }

        switch ($this->getCast()) {
            case 'int':
            case 'integer':
                return (int) $value;
            case 'real':
            case 'float':
            case 'double':
                return (float) $value;
            case 'string':
                return (string) $value;
            case 'bool':
            case 'boolean':
                return (bool) $value;
            case 'object':
                return $this->fromJson($value, true);
            case 'array':
            case 'json':
                return $this->fromJson($value);
            case 'collection':
                return new Collection($this->fromJson($value));
            case 'comma':
                return $this->fromCommaSeparated($value);
            default:
                return $value;
        }
    }
20223
protected function getType($value)
    {
        if (is_object($value)) {
            return get_class($value);
        } elseif (is_null($value)) {
            return 'null';
        } elseif (is_string($value)) {
            return 'string';
        } elseif (is_array($value)) {
            return 'array';
        } elseif (is_int($value)) {
            return 'integer';
        } elseif (is_bool($value)) {
            return 'boolean';
        } elseif (is_float($value)) {
            return 'float';
        } elseif (is_resource($value)) {
            return 'resource';
        } else {
            return 'unknown';
        }
    }
1018394
public static function determine($value): string
    {
        $type = \gettype($value);

        switch ($type) {
            case 'object':
                return \get_class($value);

            case 'integer':
                return 'int';

            case 'boolean':
                return 'bool';

            case 'NULL':
                return 'null';

            case 'double':
                return 'float';

            default:
                return $type;
        }
    }
894822
private function convertType($value)
    {
        $type = gettype($value);

        if ($this->type === $type || !is_scalar($value)) {
            return $value;
        }

        switch ($this->type) {
            case self::TYPE_BOOL:
                return $this->convertBool($value);
            case self::TYPE_INT:
                return $this->convertInt($value);
            case self::TYPE_FLOAT:
                return $this->convertFloat($value);
            default:
                return $this->convertString($value);
        }
    }