Is it possible to restrict how a method can be called in PHP?
- by Ashley Ward
Given that my class looks like this:
class Methods{
function a(){
return 'a';
}
function b(){
$this->a();
}
function c(){
$this->a();
}
}
Is it possible to ensure that function a can only be called from function b?
In the above example function c should fail. I could just include it in function b, but in the future I may want to let a() be called by some new functions (e.g. d() or e())