protected function determineDynamicType($mix_value)
    {
        switch(gettype($mix_value)) {
            case 'boolean':
                $int_dynamic_type = Schema::PROPERTY_BOOLEAN;
                break;

            case 'integer':
                $int_dynamic_type = Schema::PROPERTY_INTEGER;
                break;

            case 'double':
                $int_dynamic_type = Schema::PROPERTY_DOUBLE;
                break;

            case 'string':
                $int_dynamic_type = Schema::PROPERTY_STRING;
                break;

            case 'array':
                $int_dynamic_type = Schema::PROPERTY_STRING_LIST;
                break;

            case 'object':
                if($mix_value instanceof \DateTimeInterface) {
                    $int_dynamic_type = Schema::PROPERTY_DATETIME;
                    break;
                }
                if($mix_value instanceof Geopoint) {
                    $int_dynamic_type = Schema::PROPERTY_GEOPOINT;
                    break;
                }
                $int_dynamic_type = Schema::PROPERTY_STRING;
                if(method_exists($mix_value, '__toString')) {
                    $mix_value = $mix_value->__toString();
                } else {
                    $mix_value = null;
                }
                break;

            case 'resource':
            case 'null':
            case 'unknown type':
            default:
                $int_dynamic_type = Schema::PROPERTY_STRING;
                $mix_value = null;
        }
        return [
            'type' => $int_dynamic_type,
            'value' => $mix_value
        ];
    }
protected function determineDynamicType($mix_value)
    {
        switch(gettype($mix_value)) {
            case 'boolean':
                $int_dynamic_type = Schema::PROPERTY_BOOLEAN;
                break;

            case 'integer':
                $int_dynamic_type = Schema::PROPERTY_INTEGER;
                break;

            case 'double':
                $int_dynamic_type = Schema::PROPERTY_DOUBLE;
                break;

            case 'string':
                $int_dynamic_type = Schema::PROPERTY_STRING;
                break;

            case 'array':
                $int_dynamic_type = Schema::PROPERTY_STRING_LIST;
                break;

            case 'object':
                if($mix_value instanceof \DateTimeInterface) {
                    $int_dynamic_type = Schema::PROPERTY_DATETIME;
                    break;
                }
                if($mix_value instanceof Geopoint) {
                    $int_dynamic_type = Schema::PROPERTY_GEOPOINT;
                    break;
                }
                $int_dynamic_type = Schema::PROPERTY_STRING;
                if(method_exists($mix_value, '__toString')) {
                    $mix_value = $mix_value->__toString();
                } else {
                    $mix_value = null;
                }
                break;

            case 'resource':
            case 'null':
            case 'unknown type':
            default:
                $int_dynamic_type = Schema::PROPERTY_STRING;
                $mix_value = null;
        }
        return [
            'type' => $int_dynamic_type,
            'value' => $mix_value
        ];
    }
protected function determineDynamicType ( $ mix_value ) { switch ( gettype ( $ mix_value ) ) { case 'boolean' : $ int_dynamic_type = Schema :: PROPERTY_BOOLEAN ; break ; case 'integer' : $ int_dynamic_type = Schema :: PROPERTY_INTEGER ; break ; case 'double' : $ int_dynamic_type = Schema :: PROPERTY_DOUBLE ; break ; case 'string' : $ int_dynamic_type = Schema :: PROPERTY_STRING ; break ; case 'array' : $ int_dynamic_type = Schema :: PROPERTY_STRING_LIST ; break ; case 'object' : if ( $ mix_value instanceof \ DateTimeInterface ) { $ int_dynamic_type = Schema :: PROPERTY_DATETIME ; break ; } if ( $ mix_value instanceof Geopoint ) { $ int_dynamic_type = Schema :: PROPERTY_GEOPOINT ; break ; } $ int_dynamic_type = Schema :: PROPERTY_STRING ; if ( method_exists ( $ mix_value , '__toString' ) ) { $ mix_value = $ mix_value -> __toString ( ) ; } else { $ mix_value = null ; } break ; case 'resource' : case 'null' : case 'unknown type' : default : $ int_dynamic_type = Schema :: PROPERTY_STRING ; $ mix_value = null ; } return [ 'type' => $ int_dynamic_type , 'value' => $ mix_value ] ; }
Dynamically determine type for a value

@param $mix_value
@return array
Dynamically determine type for a value