static public function factory($object)
    {
        if (!isset($object->type)) {
            throw new ObjectException('The object has no type.');
        }

        $type = (string)$object->type;
        if (!isset(self::$types[$type])) {
            throw new NoSupportException(sprintf('The object type "%s" is unknown or invalid.', $type));
        }

        $class = '\\Omlex\\Object\\'.self::$types[$type];
        if (!class_exists($class)) {
            throw new ObjectException(sprintf('The object class "%s" is invalid or not found.', $class));
        }

        $instance = new $class($object);
        return $instance;
    }
static public function factory($object)
    {
        if (!isset($object->type)) {
            throw new ObjectException('The object has no type.');
        }

        $type = (string)$object->type;
        if (!isset(self::$types[$type])) {
            throw new NoSupportException(sprintf('The object type "%s" is unknown or invalid.', $type));
        }

        $class = '\\Omlex\\Object\\'.self::$types[$type];
        if (!class_exists($class)) {
            throw new ObjectException(sprintf('The object class "%s" is invalid or not found.', $class));
        }

        $instance = new $class($object);
        return $instance;
    }
static public function factory ( $ object ) { if ( ! isset ( $ object -> type ) ) { throw new ObjectException ( 'The object has no type.' ) ; } $ type = ( string ) $ object -> type ; if ( ! isset ( self :: $ types [ $ type ] ) ) { throw new NoSupportException ( sprintf ( 'The object type "%s" is unknown or invalid.' , $ type ) ) ; } $ class = '\\Omlex\\Object\\' . self :: $ types [ $ type ] ; if ( ! class_exists ( $ class ) ) { throw new ObjectException ( sprintf ( 'The object class "%s" is invalid or not found.' , $ class ) ) ; } $ instance = new $ class ( $ object ) ; return $ instance ; }
Create an Omlex object from result

@param object $object Raw object returned from API

@return object Instance of object driver

@throws ObjectException    On object errors
@throws NoSupportException When object type is not supported or unknown
Create an Omlex object from result