Re: Aspect Oriented Programming in PHP

From: Date: Fri, 24 Aug 2012 17:06:49 +0000
Subject: Re: Aspect Oriented Programming in PHP
References: 1 2 3 4  Groups: php.internals 
Request: Send a blank email to internals+get-62453@lists.php.net to get a copy of this message
In addition, I think that the hook syntax has to be changed into the "call_user_func" one (instead of... "$obj->foo()" do array($obj, 'foo') )
I think the current syntax is fine. Keep in mind, you can use wildcards in that syntax, I do in my application, for example: // before all controller actions aop_add_before(
    'MySite\Controller\UserController->*Action()',
    array($this, 'adviseUserController')
); Also, the object has not been created yet (there is no $obj), but I know I want to catch particular objects by a particular type. I do not know what currently happens if I keyed on an instanceof instead of an exact type. I don't think you can successfully translate a wildcard match to a callable array and have the same meaning conveyed as clearly. What I don't want is a more complex syntax than that is already supported. -ralph

« previous php.internals (#62453) next »