Re: [PEPr] +1 for Authentication::OpenID

From: Date: Thu, 09 Feb 2006 17:34:35 +0000
Subject: Re: [PEPr] +1 for Authentication::OpenID
References: 1 2 3  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-41270@lists.php.net to get a copy of this message
Josh Hoyt wrote:
One more question: On 9 Feb 2006 09:22:16 -0000, Markus Tacker <m@tacker.org> wrote:
* Implementing functions as methods
Should we just create an arbitrary class (like Auth_OpenID) and dump all of the functions in it? The functions that we have that are not methods are not related to each other and do not naturally go in a particular class.
Yes. It will give others the ability to extend and modify your class to create new functionality. I can't extend a function.
I don't know if this is even debatable, but I always feel uneasy about a class that will never be instantiated. It seems like asking for trouble. (What would it mean if someone instantiated it? I know the answer is "don't do that", but making it a function instead of a static method makes it so you *can't* do that.)
If the class should never be instantiated then you can add something like this: class Auth_OpenID {
    function Auth_OpenID
    {
        PEAR::raiseError('Auth_OpenID should not be instantiated directly.', AUTH_OPENID_SOMEERRORCODE, PEAR_ERROR_DIE);
    }
    // ...
} -- Scott Mattocks http://www.crisscott.com

« previous php.pear.dev (#41270) next »