public static function i()
    {
        $class = get_called_class();

        //if it's not set
        if (!isset(self::$instances[$class])) {
            //set it
            $args = func_get_args();
            self::$instances[$class] = new $class(...$args);
        }

        return self::$instances[$class];
    }
public static function i()
    {
        $class = get_called_class();

        //if it's not set
        if (!isset(self::$instances[$class])) {
            //set it
            $args = func_get_args();
            self::$instances[$class] = new $class(...$args);
        }

        return self::$instances[$class];
    }
public static function i ( ) { $ class = get_called_class ( ) ; //if it's not set if ( ! isset ( self :: $ instances [ $ class ] ) ) { //set it $ args = func_get_args ( ) ; self :: $ instances [ $ class ] = new $ class ( ... $ args ) ; } return self :: $ instances [ $ class ] ; }
One of the hard thing about instantiating classes is
that design patterns can impose different ways of
instantiating a class. The word "new" is not flexible.
Authors of classes should be able to control how a class
is instantiated, while leaving others using the class
oblivious to it. All in all its one less thing to remember
for each class call. By default we instantiate classes with
this method.

@param mixed[,mixed..] $args Arguments to pass to the constructor

@return SingletonTrait
One of the hard thing about instantiating classes is that design patterns can impose different ways of instantiating a class . The word new is not flexible . Authors of classes should be able to control how a class is instantiated while leaving others using the class oblivious to it . All in all its one less thing to remember for each class call . By default we instantiate classes with this method .