本文整理汇总了PHP中Dispatcher::hasListeners方法的典型用法代码示例。如果您正苦于以下问题:PHP Dispatcher::hasListeners方法的具体用法?PHP Dispatcher::hasListeners怎么用?PHP Dispatcher::hasListeners使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dispatcher
的用法示例。
在下文中一共展示了Dispatcher::hasListeners方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAuthenticationContent
/**
* Get content from listeners
*/
public function getAuthenticationContent()
{
$content = '';
if ($this->dispatcher->hasListeners(UserEvents::USER_AUTHENTICATION_CONTENT)) {
$event = new AuthenticationContentEvent($this->request);
$this->dispatcher->dispatch(UserEvents::USER_AUTHENTICATION_CONTENT, $event);
$content = $event->getContent();
// Remove post_logout session after content has been generated
$this->request->getSession()->remove('post_logout');
}
return $content;
}
示例2: isResourceActionImplemented
/**
* Returns true if the listener is implemented for a resourceType and an action
*
* @param ResourceType $resourceType
* @param string $actionName
*/
public function isResourceActionImplemented(ResourceType $resourceType = null, $actionName)
{
if ($resourceType) {
$alwaysTrue = array('rename', 'edit-properties', 'edit-rights', 'open-tracking');
//first, directories can be downloaded even if there is no listener attached to it
if ($resourceType->getName() === 'directory' && $actionName == 'download') {
return true;
}
if (in_array($actionName, $alwaysTrue)) {
return true;
}
$eventName = $actionName . '_' . $resourceType->getName();
} else {
$eventName = 'resource_action_' . $actionName;
}
return $this->dispatcher->hasListeners($eventName);
}