I am building an API where the user requests a 'command', which is passed into a class. Assuming the command matches a PUBLIC function, it will execute successfully. If the command matches a PROTECTED function, it needs to throw an error.
Fikir işlevleri korunan KAMU onları değiştirmek yerine, onları yeniden adlandırma ya da bunları kaldırarak devre dışı olmasıdır.
Şu anda bu, ama komut kamu veya korumalı ise farketmez.
<?php
/**
* Look for Command method
*/
$sMethod = "{$sCommand}Command";
if (method_exists($this, $sMethod))
{
/**
* Run the command
*/
return $this->$sMethod($aParameters);
}