- method_exists: documentation ( source)
<?php
class BaseController{
public function __call(string $Action, array $Data){
if (method_exists($this, $Action . "Action")) {
} else if (method_exists($this, "DefaultAction")) {
if ($this->DefaultAction($Action, $Data)){
}
exit;
}
}
}
class TestPage extends BaseController{
private function DefaultAction(string $Action, array $Data): bool{
return false;
}
}
$testpage = new TestPage();
$testpage->Show();