Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:9557 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 74468 invoked by uid 1010); 25 Apr 2004 17:33:09 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 74384 invoked from network); 25 Apr 2004 17:33:09 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 25 Apr 2004 17:33:09 -0000 Received: from BAUMBART (p508EB3E4.dip.t-dialin.net [80.142.179.228]) by shiva.mind.de (Postfix) with ESMTP id CBC2097B4F; Sun, 25 Apr 2004 19:33:07 +0200 (CEST) Date: Sun, 25 Apr 2004 19:33:12 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <603759690.20040425193312@marcus-boerger.de> To: Julian Reich Cc: internals@lists.php.net In-Reply-To: <408BEF30.60003@eenterphace.org> References: <408BEF30.60003@eenterphace.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] new_object_array() From: helly@php.net (Marcus Boerger) Hello Julian, adding a new function seens the wron way. I'd prefer adding this functionality to the reflection API. Hande a look at Zend/zend_reflection_api.c: ZEND_METHOD(reflection_class, newInstance) marcus Sunday, April 25, 2004, 7:02:40 PM, you wrote: > Hi all, > Referring to call_user_func_array() I would like to suggest a new > function: new_object_array(). > I'm working on a php5 application framework and I would like to > implement something I call an unified factory. The problem is that I > don't know how many parameters to expect. > Here's an example how it's meant to work: > class Kernel > { > public function __call($functionName, $functionParameters) > { > $className = substr($functionName, 3); > // code omitted here ... > // check for real $className ... > return new_object_array($className, $functionParameters); > } > public function newObject() > { > $functionParameters = func_get_args(); > $className = array_shift($functionParameters); > // code omitted here ... > // check for real $className ... > return new_object_array($className, $functionParameters); > } > } > $Kernel = Kernel::getInstance(); > $DbManager = $Kernel->getDbManager('param1', 'param2'); // 1st > possibility to get new object > $XmlParser = $Kernel->newObject('XmlParser', 'param1', 'param2'); // 2nd > possibility to get new object ?>> > I have written an implementation of new_object_array(); <-- see attachment > Perhaps some things need to be rewritten ;) > I would be happy if you would consider to include this function in the > standard distribution of php. > Yours sincerly, > Julian Reich -- Best regards, Marcus mailto:helly@php.net