is there a way to create a class method for a class from another class?
Example:
class A
{
public function makeMethod()
{
$this->b = new B();
//create a method for class B such as a __call() method
//to catch an error trying to access a non existant class B method
if (!method_exists($this->b, "__call")
// create __call() method
}
}
class B
{
}
Have a look at this example :
This will output :
So, in a way, we called a non-existant function of
class Band we still can do something with that…. e.g. in your__callmethod inclass Bcouldn’t you point the execution to some callback function (even ofclass A)? Why “create” it? (Don’t think from the developer’s point of view, unless you absolutely have to… :-))Just an idea…
A glimpse from Page/Module Execution handling in Minima Framework :
P.S. Simply because I’ve already created a 100% PHP framework myself, and perhaps I know what you might need…