src/Primitive/Support/Traits/RetrievableTrait.php
public function getNumberable($value, $default = null)
    {
        switch(true)
        {
            case is_int($value):
            case is_float($value):
                return $value;
            case is_numeric($value) && strpos($value, '.'):
                return (float) $value;
            case is_numeric($value):
            case is_bool($value):
                return (int) $value;
            case $value instanceof IntegerContract:
            case $value instanceof FloatContract:
                return $value->value();
            case $value instanceof BooleanContract:
                return $value->toInt()->value();
            case $value instanceof StringContract:
                return (int) $value->value();
            default:
                return value($default);
        }
    }
public function getNumberable($value, $default = null)
    {
        switch(true)
        {
            case is_int($value):
            case is_float($value):
                return $value;
            case is_numeric($value) && strpos($value, '.'):
                return (float) $value;
            case is_numeric($value):
            case is_bool($value):
                return (int) $value;
            case $value instanceof IntegerContract:
            case $value instanceof FloatContract:
                return $value->value();
            case $value instanceof BooleanContract:
                return $value->toInt()->value();
            case $value instanceof StringContract:
                return (int) $value->value();
            default:
                return value($default);
        }
    }
Retrieve number from any type or return default.

@param $value
@param null|mixed $default
@return float|int|mixed