Returns a specific event by name.

@param string $name The event name

@return StopwatchEvent The event

@throws \LogicException When the event is not known
559309
public function getEvent($name)
    {
        if (!isset($this->events[$name])) {
            throw new \LogicException(sprintf('Event "%s" is not known.', $name));
        }

        return $this->events[$name];
    }
996491
protected static function trigger($name)
    {
        if (isset(static::$_hooks[$name])) {
            $events = [];
            
            foreach (static::$_hooks[$name] as $hookEvent) {
                if ($hookEvent->isHandled) {
                    continue;
                }
                
                if (is_array($hookEvent->handler)) {
                    $hookEvent->output = call_user_func_array($hookEvent->handler, [$hookEvent]);
                } elseif (is_callable($hookEvent->handler)) {
                    $hookEvent->output = call_user_func($hookEvent->handler, $hookEvent);
                } else {
                    throw new Exception("The provided hook event handler is not valid.");
                }
                
                $hookEvent->isHandled = true;
                
                if ($hookEvent->isValid) {
                    $events[] = $hookEvent;
                }
            }

            return $events;
        }

        return [];
    }
1067969
public function getBlockByName($name) {
		foreach($this->blockManifest as $block) {
			if($block->getName() == $name) {
				return $block;
			}
		}
		return false;
	}
364808
private function callback(string $name)
    {
        if (!$this->hasCallback($name)) {
            throw new XslCallbackException('A callback with the name ' . $name . ' does not exist.');
        }

        return $this->callbacks[$name];
    }
784044
public function getMonitorFrom($name = null)
    {
        if ($name) {
            if (isset($this['monitor'], $this['monitor'][$name], $this['monitor'][$name]['from']) &&
                    trim($this['monitor'][$name]['from'])) {
                return $this['monitor'][$name]['from'];
            }
        }
        if (isset($this['monitor'], $this['monitor']['default'], $this['monitor']['default']['from']) &&
                trim($this['monitor']['default']['from'])) {
            return $this['monitor']['default']['from'];
        }

        $email = $this->getSiteEmail();
        if ($email) {
            return $email;
        }

        return 'noreply@gemstracker.org';
    }
454148
protected function getObjectManagerByName($name)
    {
        if (array_key_exists($name, $this->objectManagerByName)) {
            return $this->objectManagerByName[$name];
        }

        $event = clone $this->getManagerRegistryResourceEventPrototype();
        $event->setName(ManagerRegistryResourceEvent::RESOLVE_OBJECT_MANAGER_EVENT);
        $event->setResourceName($name);
        $event->setTarget($this);


        $resultsEvent = $this->getEventManager()->trigger($event, function ($objectManager) {
            return $objectManager instanceof ObjectManager;
        });

        $objectManager = $resultsEvent->last();

        if (!$objectManager instanceof ObjectManager) {
            $errMsg = sprintf('Object manager %s not found', $name);
            throw new Exception\ObjectManagerNotFoundException($errMsg);
        }

        $this->objectManagerByName[$name] = $objectManager;

        return $this->objectManagerByName[$name];
    }
1020531
public function transform( string $name, StopwatchEvent $event ): Stopwatch_Record {

		$backtrace = $this->formatter->format( $this->callers[ $name ] );

		return new Stopwatch_Record( $name, $event, implode( '<br />', $backtrace ) );
	}
1353864
public function getExtension($name)
    {
        if ($this->hasExtension($name)) {
            return $this->_extensions[$name];
        }

        throw new HandlerNotFoundException(get_class($this).": No extension named \"$name\" found");
    }
342991
public function stop(?string $name = null): Item
    {
        $name = $name ?? self::BASE_ITEM;
        $item = $this->items[$name] ?? null;

        if (null !== $item) {
            unset($this->activeItems[$name]);

            return $item->stop();
        }

        throw new \InvalidArgumentException(sprintf('Item with name %s not found!', $name));
    }
82561
public function findOperator($name)
    {
        $operator = ucfirst($name);
        foreach (array_keys($this->operatorNamespaces) as $namespace) {
            $class = $namespace . '\\' . $operator;
            if (class_exists($class)) {
                return $class;
            }
        }

        throw new \LogicException(sprintf('Unknown operator: "%s"', $name));
    }
279114
protected function getAuthenticator($name = 'default')
    {
        $authenticators = $this->authenticators;

        if (isset($authenticators[$name])) {
            return $authenticators[$name];
        }

        throw new LogicException('No valid authenticator found');
    }
286255
public function getDefaultEventByName($name)
    {
        foreach ($this->getDefaultEvents() as $event) {
            if ($event['name'] === $name) {
                return $event;
            }
        }

        return null;
    }
287061
public static function get($class, $name)
    {
        $class = ObjectHelper::getClass($class);
        return !empty(static::$events[$class][$name]) ? static::$events[$class][$name] : null;
    }
158842
public function hasEvent($name)
    {
        foreach ($this->_events as $event) {
            if ($event->getName() === $name) {
                return true;
            }
        }

        return false;
    }
264388
public function getEvent($name)
    {

        if (!isset($this->_events))
            $this->_events = [];

        if (!isset($this->_events[$name])) {

            $className = $this->getEventClassName();
            $this->_events[$name] = new $className($name);
        }

        return $this->_events[$name];
    }
948798
public function get(string $name) : EventHandlerInterface
    {
        if (!isset($this->eventHandlers[$name])) {
            throw new \InvalidArgumentException(sprintf('DataGrid event handler %s not found', $name));
        }

        return $this->eventHandlers[$name];
    }
147755
public static function dispatcher($name)
	{
		static $all = [];

		if(! isset($all[$name]))
		{
			// system has been installed
			// use default mode
			if(Helper::isSystemInstall())
			{
				$cache = new Cache($name, 'events');

				if( $cache->ready() )
				{
					$data = $cache->import();
				}
				else
				{
					$event = new EventFactory($name);
					if( $event->load() === false )
					{
						throw new NotFoundException("Event '{$name}' is not registered in system");
					}

					$data = $event->getContentData();
					if(! $cache->export($data))
					{
						throw new WriteException("Can't write cache data for the '{$name}' event");
					}
				}
			}
			else
			{
				$data = (new EventFactory($name))->getContentData();
			}

			$manager = new Dispatcher(
				$data["name"],
				$data["completable"],
				function (Dispatcher $manager) use ($data) {
					foreach($data["classes"] as $class_name)
					{
						/** @var \EApp\Event\Interfaces\EventPrepareInterface $class */
						$class = new $class_name($data["name"]);
						$class->prepare($manager);
					}
				});

			$all[$name] = $manager;
		}

		return $all[$name];
	}