Re: reference caller object

From: Date: Thu, 17 Sep 2009 16:46:04 +0000
Subject: Re: reference caller object
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-45593@lists.php.net to get a copy of this message
On Wed, Sep 16, 2009 at 1:59 PM, Chris Trahey <ctrahey@csisd.org> wrote: > (Please direct me elsewhere if necessary, this is a feature request) > > It would be handy to allow a method to behave differently based on who is > calling it. > the function I am looking for would essentially do this: > .. snip .. Type hinting would be a clean approach, I can not see a argument why the below would be less correct. public function registerMe(Loadable $oLoadable) { if( ! ($this->authenticateMod($oLoadable))) throw new admin_exception('module not active'); $this->loadedMods[$oLoadable->module_id()] = $oLoadable; return $oLoadable->onLoad(); }

« previous php.internals (#45593) next »