public static function getInstance()
    {
        $self = get_called_class();
        if (!isset(self::$instances[$self])) {
            self::$instances[$self] = new $self;
        }
        return self::$instances[$self];
    }
public static function getInstance()
    {
        $self = get_called_class();
        if (!isset(self::$instances[$self])) {
            self::$instances[$self] = new $self;
        }
        return self::$instances[$self];
    }
public static function getInstance ( ) { $ self = get_called_class ( ) ; if ( ! isset ( self :: $ instances [ $ self ] ) ) { self :: $ instances [ $ self ] = new $ self ; } return self :: $ instances [ $ self ] ; }
Returns instance, if instance does not exist then creates new one and returns it

@return $this
Returns instance if instance does not exist then creates new one and returns it