* @param string $module
* @param string $controller
* @param array $params
* @param bool $checkAccess
* @return null|string
* @throws ViewException
*/
return function ($module, $controller, $params = [], $checkAccess = false) {
/**
* @var View $this
*/
try {
if ($checkAccess) {
try {
$controllerInstance = new Controller($module, $controller);
$controllerInstance->checkPrivilege();
} catch (ForbiddenException $e) {
return null;
}
}
} catch (\Exception $e) {
throw new ViewException('Url View Helper: ' . $e->getMessage());
}
if (null === $module) {
$module = Request::getModule();
}
if (null === $controller) {
$controller = Request::getController();
}
if (null === $params) {
$params = Request::getParams();