I've a question about the __call method in PHP 5.
If I have 2 aggregated instances in my class. For example:
Code: Select all
public function _ _construct( ) {
$this->class1 = new Class1;
$this->class1 = new Class1;
}And these classes have methods with the same name. How does the _call function decides which method to invoke ?
Code: Select all
//aggregation
public function __call($method, $arguments) {
if (method_exists($this->aggregatedInstance, $method)) {
return call_user_func_array(array($this->address, $method), $arguments);
}
}thanks