Re: Re: Using XML_RPC with object oriented code

From: Date: Tue, 10 Feb 2004 16:01:31 +0000
Subject: Re: Re: Using XML_RPC with object oriented code
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-10606@lists.php.net to get a copy of this message
True. This does require the use of a static function. You can, however, work around the problem. If the request is dispatched by a Singleton, as is usual, you just have to do something like: class Foo { function bar() { if (!isset($this)) {
     $obj = Foo::getSingleton();
     return $obj->bar();
} (rest of bar) } } If the request is served by an arbitrary instance, use function static variables (this is way uglier): class Foo { function realBar(...) { (...) } function bar(..., $fooInstance = null) { static $foo = null; if (!isnull(fooInstance)) {
     $foo = $fooInstance;
} else {
     $foo->bar(...);
} } } Foo::bar must be called with $fooInstance set before it can service any request. Cheers, Sérgio Norman Elton wrote:
Wouldn't this require that it be a static function? How could I access the member variables of the object instance? Norman


« previous php.pear.general (#10606) next »