I have a webservice class with a number of private functions. I have a main function which decides which function to call according to the first parameter of the web service call.
$actions = [
"CHECK_LOGIN" => "checkLogin"
, "CHECK_FB" => "checkFB"
, "GET_DETAILS" => "getDetails"
, "SAVE_DETAILS" => "saveDetails"
, "CHANGE_PWD" => "saveDetails"
, "SEND_ECODE" => "sendEmailCode"
]
So, its easy to find which function to call according to the parameter passed:
if (!array_key_exists($action, $actions))
$rep = ["status" => STATUS_ERROR, "errMsg" => "Action '$action' unknown"];
else {
$method = $actions[$action];
$rep = $method($req);
}
My problem is that I can't call "$method" what ever it is (e.g. "checkFB"), I need to call $this->method (i.e. "$this->checkFB") How do I put the $this-> in front of the function name found in the $actions array??