public \Joomla\CMS\MVC\Controller\BaseController
getController
(string $name, string $client = '', array $config = array())
/**
* Get a controller from the component
*
* @param string $name Controller name
* @param string $client Optional client (like Administrator, Site etc.)
* @param array $config Optional controller config
*
* @return BaseController
*
* @since 4.0.0
*/
public function getController(string $name, string $client = '', array $config = array()) : BaseController
{
// Set up the client
$client = $client ?: ucfirst($this->app->getName());
// Get the controller instance
$controller = $this->mvcFactory->createController($name, $client, $config, $this->app, $this->input);
// Check if the controller could be created
if (!$controller) {
throw new \InvalidArgumentException(Text::sprintf('JLIB_APPLICATION_ERROR_INVALID_CONTROLLER_CLASS', $name));
}
return $controller;
}