Trigger an event on this object.

@param string $name
Name of event.
@param Event $event
Event object.
@return bool False if event was stopped, true otherwise.
328750
public function triggerEvent($name, Event $event = null)
    {
        return $this->e->trigger($name, $event);
    }
419570
protected function dispatchEvent($eventName, \Symfony\Component\EventDispatcher\Event $event)
    {
        if (!$event->isPropagationStopped()) {
            $dispatcher = $this->getEventDispatcher();
            $dispatcher->dispatch($eventName, $event);
        }
        return !$event->isPropagationStopped();
    }
997103
public function forwardEvent(Event $event, $name)
    {
        if (!$this->enabled) {
            return;
        }

        $this->pushServer->send($this->eventSerializer->serializeEvent($name, $event));
    }
158842
public function hasEvent($name)
    {
        foreach ($this->_events as $event) {
            if ($event->getName() === $name) {
                return true;
            }
        }

        return false;
    }
1198908
public function trigger($name, $event = null)
	{
		$this->ensureEvents();
		
		$this->ensureEventListeners();
		
		$this->bindEventListenersEvents();
		
		if (!empty($this->_events[$name])) {
		    // 增加事件处理的动态参数
		    $args = func_get_args();
		    array_shift($args);
		    
			if (!$event instanceof Event) {
				$event = new Event();
				array_unshift($args, $event);
			}
			if ($event->sender === null) {
				$event->sender = $this;
			}
			
			$event->name = $name;
			
			foreach ($this->_events[$name] as $handler) {
			    if (isset($handler[1]) && $handler[1]) {
			        $olddata = $handler[1];
			        $event->data = array_merge($olddata, $event->data);
			    }
			    
			    if (is_string($handler[0]) && strpos($handler[0], ':') === false) {
			        $callable = [$this, $handler[0]];
			    } else {
			        $callable = Ioc::resolveCallable($handler[0]);
			    }
			    
			    // call_user_func($callable, $event);
			    call_user_func_array($callable, $args);
			    
			    // stop further handling if the event is handled
			    if ($event->isPropagationStopped()) {
			        return;
			    }
			}
		}
		
		// invoke class-level attached handlers
		Event::trigger($this, $name, $event);
	}
600778
public function trigger($event, $data = FALSE, $last = TRUE)
    {
        if (isset($this->$event) && is_array($this->$event))
        {
            foreach ($this->$event as $method)
            {
                if (strpos($method, '('))
                {
                    preg_match('/([a-zA-Z0-9\_\-]+)(\(([a-zA-Z0-9\_\-\., ]+)\))?/', $method, $matches);

                    $method = $matches[1];
                    $this->callback_parameters = explode(',', $matches[3]);
                }

                $data = call_user_func_array(array($this, $method), array($data, $last));
            }
        }

        return $data;
    }
1190673
public function hasEventHandler($name)
    {
        $name = strtolower($name);
        return isset($this->_events[$name]) && count($this->_events[$name]) > 0;
    }
402476
public function trigger($event, $args = null)
    {
        if ($args === null) {
            $args = [];
        }

        settype($args, 'array');

        $prefix = XTAINJoomlaBundle::STOPWATCH_PREFIX;
        $eventUnderscore = Inflector::tableize($event);

        $beforeEvent = new BeforeEvent($args);
        self::$eventDispatcher->dispatch(self::PREFIX_BEFORE . $eventUnderscore, $beforeEvent);

        if (self::$stopwatch !== null) {
            self::$stopwatch->start($prefix . '.event.' . $eventUnderscore);
        }

        $return = parent::trigger($event, $beforeEvent->getArguments());

        if (self::$stopwatch !== null) {
            self::$stopwatch->stop($prefix . '.event.' . $eventUnderscore);
        }

        $afterEvent = new AfterEvent($args, $return);
        self::$eventDispatcher->dispatch(self::PREFIX_AFTER . $eventUnderscore, $afterEvent);

        return $afterEvent->getResult();
    }
851103
public function dispatch($name, Event $event = null)
    {
        if (! $this->hasListener($name)) return;

        if (! $event) $event = new Event();
        $event->setDispatcher($this);
        $event->setName($name);

        foreach ($this->getListners($name) as $listener) {
            call_user_func($listener, $event);
            if ($event->isStop()) break;
        }
    }
787473
public function fireEvent($name, $params = null)
    {
        $handleList = Utility::get($this->events, $name, null);
        $result = true;
        if ($handleList) {
            foreach ($handleList as $methodName) {
                if (gettype($methodName) == "string") {
                    $return = $this->$methodName($params);
                } else {
                    $return = $methodName($params);
                }
                $result &= ($return !== null) ? $return : true;
            }
        }
        //Allow to write event handle in the report
        if (method_exists($this, $name)) {
            $return = $this->$name($params);
            $result &= ($return !== null) ? $return : true;
        }
        return $result;
    }
1341215
public static function trigger($name, $data = [], $target = null, $paramClass = EventParam::class)
    {
        static::getInstance()->__trigger($name, $data, $target, $paramClass);
    }
1251629
private function onEvent($event)
    {
        if (isset($this->_options[$event])) {
            $onEvent = strtoupper($this->_options[$event]);

            if (! in_array($onEvent, ['NO ACTION', 'RESTRICT'])) {
                return $onEvent;
            }
        }

        return false;
    }
881764
function handle(Event $event)
    {
        if ($this->accept($event)) {
            $this->onEvent($event);
            return true;
        }

        return false;
    }
291870
protected function trigger($event)
    {
        $class = static::class;

        if ($this->withEvent && isset(self::$event[$class][$event])) {
            foreach (self::$event[$class][$event] as $callback) {
                $result = call_user_func_array($callback, [$this]);

                if (false === $result) {
                    return false;
                }
            }
        }

        return true;
    }
284131
public function event($event, ...$args){
        if($this->eventManager !== null){
            return $this->eventManager->trigger($event, $args);
        }

        return false;
    }
169347
public function detachHandler($name, callable $callback)
    {
        if (! isset($this->events[$name])) {
            return false;
        }
        $index = array_search($callback, $this->events[$name], true);
        if ($index === false) {
            return false;
        }
        unset($this->events[$name][$index]);
        return true;
    }
180203
public function trigger($event = null)
    {
        //argument 1 must be string
        Argument::i()->test(1, 'string', 'null');

        call_user_func_array(
            array(Event::i(), 'trigger'),
            func_get_args()
        );

        return $this;
    }