public static function calcObjectType()

in src/Apache/Ignite/Internal/Binary/BinaryUtils.php [214:259]


    public static function calcObjectType($object)
    {
        if (is_integer($object)) {
            return ObjectType::INTEGER;
        } elseif (is_float($object)) {
            return ObjectType::DOUBLE;
        } elseif (is_string($object)) {
            return ObjectType::STRING;
        } elseif (is_bool($object)) {
            return ObjectType::BOOLEAN;
        } elseif (is_array($object)) {
            if (count($object) > 0) {
                if (BinaryUtils::isIndexedArray($object)) {
                    if ($object[0] !== null) {
                        // indexed array
                        return BinaryUtils::getArrayType(BinaryUtils::calcObjectType($object[0]));
                    }
                } else {
                    // associative array
                    return new MapObjectType();
                }
            } else {
                BinaryUtils::noDefaultMapping("empty array");
            }
        } elseif ($object instanceof Time) {
            return ObjectType::TIME;
        } elseif ($object instanceof Timestamp) {
            return ObjectType::TIMESTAMP;
        } elseif ($object instanceof Date) {
            return ObjectType::DATE;
        } elseif ($object instanceof EnumItem) {
            return ObjectType::ENUM;
        } elseif ($object instanceof BigDecimal) {
            return ObjectType::DECIMAL;
        } elseif ($object instanceof Set) {
            return new CollectionObjectType(CollectionObjectType::HASH_SET);
        } elseif ($object instanceof Map) {
            return new MapObjectType();
        } elseif ($object instanceof BinaryObject) {
            return ObjectType::BINARY_OBJECT;
        } elseif (is_object($object)) {
            return new ComplexObjectType();
        }
        BinaryUtils::noDefaultMapping(BinaryUtils::getPhpTypeName($object));
        return null;
    }