I’ve got a few functions that deal with cookies. Would it be a horrible idea to group them by moving them to a class of their own and use them as static methods?
Functions:
function cookie_get(){}
function cookie_set(){}
function cookie_delete(){}
Static methods:
class cookie
{
static function get(){}
static function set(){}
static function delete(){}
}
Yes, that would be a horrible idea because static methods are hard to test and mock. Why not just create a real Cookie class that you can configure at runtime with those methods as regular methods.
If you just want to group those functions into a package, you can just as well use Namespaces.
Edit: Since you brought it up in the comments: yes, for any testing purposes regular functions are as untestable as statics. So your initial situation is as "horrible" as changing it to use a static class. Even the pseudo namespace is not giving you any advantage, because you already applied that to your regular functions as well.
cookie_getis as good or bad asCookie::get.