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

From: Date: Thu, 09 Feb 2006 18:03:32 +0000
Subject: Re: [PEPr] +1 for Authentication::OpenID
References: 1 2 3 4 5  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-41272@lists.php.net to get a copy of this message
Josh Hoyt wrote:
I promise I'll leave this alone after this, but I don't buy your argument. If the class is never instantiated (it's all static methods), then how do you extend it? Unless there is a trick that I don't know about, calling a static method is just as rigid as calling a function. Given: function Pkg_foo(...) {...} and class Pkg {
    /**
     * @static
     */
     function foo(...) {...}
} it's no more flexible to write Pkg::foo() then it is to write Pkg_foo() since the caller must refer to Pkg by name.
I can create my own package that extends yours and not have to rewrite all of the functions. class Scotts_Class extends Auth_OpenID {
    function foo()
    {
        // Change the way foo works to do some extra processing.
        $val = parent::foo();
        $val = strtoupper($val);
        return $val;
    }
    function bar()
    {
        // Rewrite bar completely.
        return 'Scott\'s version.';
    }
} Now I have a new class that does the same thing as Auth_OpenID except uses my implementation of foo(). The class is customized to my needs and I didn't have to rewrite tons of code. It isn't a question of how you call or use a function/method. It's a question of how easily the class can grow and be used by other developers to make something better. -- Scott Mattocks http://www.crisscott.com

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