Re: cvs: phpdoc /en/language/oop5 patterns.xml

From: Date: Fri, 29 Oct 2004 14:23:24 +0000
Subject: Re: cvs: phpdoc /en/language/oop5 patterns.xml
References: 1  Groups: php.doc 
Request: Send a blank email to phpdoc+get-969364736@lists.php.net to get a copy of this message
Hi, First, I don't think this belongs in the PHP Manual (It has nothing to do with PHP itself, and there are many resources about patterns out there). Second, if this goes in, the examples should be "done right". Right now they look like more like PHP4 code then like PHP5 code. For example, the singleton would look better like this: class Test { static private $instance; private function __construct() { } static public function singleton() { if (!isset(self::$instance)) { self::$instance = new Test; } return self::$instance; } public function bark() { print "Woof!\n"; } } // This would fail, because the constructor is private: // $test = new Test; // But this works: $test = Test::singleton(); $test->bark(); Regards, Stefan Walk

« previous php.doc (#969364736) next »