[enh] adding the possibility of - in calls: list-mails will be called as listMails

This commit is contained in:
Benjamin Sonntag 2015-02-27 16:23:39 +01:00
parent 5a6d17b347
commit 398813ab71
1 changed files with 5 additions and 0 deletions

View File

@ -143,6 +143,11 @@ class Alternc_Api_Service {
$object = new $className($this);
$action = $request->action;
if (strpos($action,"-")!==false) {
// replace - by an uppercase letter:
$action = lcfirst(str_replace(" ", "", implode("", array_map("ucfirst", explode("-", $action)))));
}
if (!method_exists($object, $action))
return new Alternc_Api_Response(array("code" => self::ERR_ACTION_NOT_FOUND, "message" => "Action not found for this object in this AlternC's instance"));