Is there any way to get called method name, using reflection or anything else?
Suppose I have following class:
abstract class FooController {
/**
* Current language
* @var string
*/
private $language;
/**
* Controller action called by framework
* @return string
*/
public function dosomethingAction()
{
$template = $this->getLocalizedTemplate();
//do something
return $template;
}
/**
* Builds template name using current
* action name and $language value
* @return string
*/
private function getLocalizedTemplate()
{
$ACTION_NAME; //how to obtain it?
$filteredActionName = preg_replace("/Action$/", "", $ACTION_NAME);
return $filteredActionName . "_" . $this->language . '.phtml';
}
}
Aucun commentaire:
Enregistrer un commentaire