Base Controller

It is a method to get the controller name. The dispatcher name is set by default parsed using the classname, or it can be set by passing a $config['name'] in the class constructor.

  • return string - The name of the dispatcher
public function getName()
{
if (empty($this->name))
{
$r = null;

if (!preg_match('/(.*)Controller/i', get_class($this), $r))
{
throw new \Exception(\JText::_('JLIB_APPLICATION_ERROR_CONTROLLER_GET_NAME'), 500);
}

$this->name = strtolower($r[1]);
}

return $this->name;
}