Bryan Tong Minh wrote:
User::getCurrent();
It's would be part of the class actually being mentioned, and it specifies what you are trying to get, the user of the current transaction. Same would go for other things like Title::getCurrent();
It does not necessarily look nice, but keeping the current stuff in one class sounds like a better idea to me.
I think that it would be better to use something like:
Mediawiki::getUser();
Mediawiki::gettitle();
etc. The singleton knows its own members. Is there a reason to have more than one instance of Mediawiki at any time (i.e. is it ever not a singleton)?
Consider the complications of having each class have its own prime instance as well as other possible instances and knowing the difference. That would involve a lot of messy code (could be in a common base class, but nonetheless, each of these has to do its own thing).
As well, a class shouldn't know about it's instances (garbage collection schemes aside) but a class's instance should know about instances of its own members.
Mike