PHP is a procedural and object oriented language, and even though the language has started to focus more on objects that is only because function are a very strong feature of the language.
So the thing I’d like to discuss is why not convert classes that have only static methods (CHtml, some of YiiBase’s methods and similar classes) into functions. My main argument about this is that classes with only static methods is (if not a bad practice) a misuse of classes because all of the methods are just functions grouped in a convenient way.
Primarily we use classes because (unlike function) they can be extended, changing the way the class works, but in CHtml’s case the only methods we can extend (to get this effect) are “activeId()” and “activeName()”, but none of the others because there is rarely a need to change them.
Another example can be with CActiveDataProvider and CArrayDataProvider, we can have a function called data_provider($data) and it returns one of the two depending on $data, or converts the data to be used by CDataProvider directly.
Well these are just simple examples and ideas, my question is why not use function in these situations or others?