/** * @param string $alias * @return mixed * @throws EventException */ public function getEventListener($alias) { if (class_exists($alias)) { return new $alias(); } throw EventException::listenerError(sprintf('alias <%s> does not exist', $alias)); }
public function __construct(string $tag, mixed $behavior) { $objects = var_export($behavior, true); $msgs = "Add behavior to tag[{$tag}] failed, it is not callable." . PHP_EOL; $msgs .= "Behavior exports as :" . PHP_EOL; foreach ($objects as $object) { $msgs .= $object . "\n"; } $msgs = rtrim($msgs, "\n"); parent::__construct($msgs); }
/** * @param string $entityName * @param int $dependencyId */ public function __construct($entityName, $dependencyId) { $this->entityName = $entityName; $this->dependencyId = $dependencyId; parent::__construct('The event dependency "' . $this->entityName . ' with the id "' . $this->dependencyId . '" was not found.', 0); }
/** * @param string $eventId */ public function __construct($eventId) { $this->entityName = 'SuluEventBundle:Event'; $this->eventId = $eventId; parent::__construct('The event with the id "' . $this->eventId . '" was not found.', 0); }