Re: RFC: Custom Factories (SPL)
| From: | Stanislav Malyshev | Date: | Wed, 18 Nov 2009 19:43:42 +0000 |
| Subject: | Re: RFC: Custom Factories (SPL) | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-46089@lists.php.net to get a copy of this message | ||
Hi!
Here is the first draft of my RFC: http://wiki.php.net/rfc/customfactoriesSomething I'm missing in this RFC: what's wrong with factory base class doing: public static function getInstance() { if(static::$instance === NULL) { static::$instance = new static; } return static::$instance; } instead of "new self", and then the client class doing: $this->logger = WhateverLogger::getInstance(); or even: $clientLogger = $this->config['logger']; $this->logger = $clientLogger::getInstance(); Also, the whole thing, whatever it is, looks like something one would do in user space in a framework, not on language level. -- Stanislav Malyshev, Zend Software Architect stas@zend.com http://www.zend.com/ (408)253-8829 MSN: stas@zend.com