src/Entity/Reflection.php
public static function load($arg)
    {
        if (is_object($arg) && $arg instanceof Entity) {
            $class = get_class($arg);
        } elseif (is_object($arg) && $arg instanceof Collection) {
            $class = $arg->getEntityClass();
        } elseif (is_object($arg) && $arg instanceof Reflection) {

            $class = $arg->getClassName();
            if (!isset(self::$registered[$class])) {
                return self::$registered[$class] = $arg;
            }
            return $arg;
        } elseif (is_string($arg)) {
            $class = $arg;
        } else {
            throw new Exception\InvalidArgumentException(
                "Entity identifier must be object, collection, class or name!",
                $arg
            );
        }

        if (!is_subclass_of($class, "UniMapper\Entity")) {
            $class = Convention::nameToClass($arg, Convention::ENTITY_MASK);
        }

        if (!class_exists($class)) {
            throw new Exception\InvalidArgumentException(
                "Entity class " . $class . " not found!"
            );
        }

        if (isset(self::$registered[$class])) {
            return self::$registered[$class];
        }

        return self::$registered[$class] = new Reflection($class);
    }
public static function load($arg)
    {
        if (is_object($arg) && $arg instanceof Entity) {
            $class = get_class($arg);
        } elseif (is_object($arg) && $arg instanceof Collection) {
            $class = $arg->getEntityClass();
        } elseif (is_object($arg) && $arg instanceof Reflection) {

            $class = $arg->getClassName();
            if (!isset(self::$registered[$class])) {
                return self::$registered[$class] = $arg;
            }
            return $arg;
        } elseif (is_string($arg)) {
            $class = $arg;
        } else {
            throw new Exception\InvalidArgumentException(
                "Entity identifier must be object, collection, class or name!",
                $arg
            );
        }

        if (!is_subclass_of($class, "UniMapper\Entity")) {
            $class = Convention::nameToClass($arg, Convention::ENTITY_MASK);
        }

        if (!class_exists($class)) {
            throw new Exception\InvalidArgumentException(
                "Entity class " . $class . " not found!"
            );
        }

        if (isset(self::$registered[$class])) {
            return self::$registered[$class];
        }

        return self::$registered[$class] = new Reflection($class);
    }
public static function load ( $ arg ) { if ( is_object ( $ arg ) && $ arg instanceof Entity ) { $ class = get_class ( $ arg ) ; } elseif ( is_object ( $ arg ) && $ arg instanceof Collection ) { $ class = $ arg -> getEntityClass ( ) ; } elseif ( is_object ( $ arg ) && $ arg instanceof Reflection ) { $ class = $ arg -> getClassName ( ) ; if ( ! isset ( self :: $ registered [ $ class ] ) ) { return self :: $ registered [ $ class ] = $ arg ; } return $ arg ; } elseif ( is_string ( $ arg ) ) { $ class = $ arg ; } else { throw new Exception \ InvalidArgumentException ( "Entity identifier must be object, collection, class or name!" , $ arg ) ; } if ( ! is_subclass_of ( $ class , "UniMapper\Entity" ) ) { $ class = Convention :: nameToClass ( $ arg , Convention :: ENTITY_MASK ) ; } if ( ! class_exists ( $ class ) ) { throw new Exception \ InvalidArgumentException ( "Entity class " . $ class . " not found!" ) ; } if ( isset ( self :: $ registered [ $ class ] ) ) { return self :: $ registered [ $ class ] ; } return self :: $ registered [ $ class ] = new Reflection ( $ class ) ; }
Load and register reflection

@param string|Entity|Collection|Reflection $arg

@throws Exception\InvalidArgumentException

@return Reflection
Load and register reflection