/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
dev/tests/integration/framework/Magento/TestFramework/EventManager.php
53 строки
1 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 10:44
22 окт 2025, 10:44
264bea2
Код
Авторство
О чём код?
<?php /** * Copyright 2013 Adobe * All Rights Reserved. */ /** * Basic implementation of the message exchange mechanism known as pub/sub messaging pattern. * Terminology deviations: * event - message * event manager - message publisher * fire event - publish message * event subscriber - message subscriber */ namespace Magento\TestFramework; class EventManager { /** * Registered event subscribers * * @var array */ protected $_subscribers = []; /** * Constructor * * @param array $subscribers Subscriber instances */ public function __construct(array $subscribers) { $this->_subscribers = $subscribers; } /** * Notify registered subscribers, which are interested in event * * @param string $eventName * @param array $parameters Parameters to be passed to each subscriber * @param bool $reverseOrder Whether subscribers should be notified in reverse order */ public function fireEvent($eventName, array $parameters = [], $reverseOrder = false) { $subscribers = $reverseOrder ? array_reverse($this->_subscribers) : $this->_subscribers; foreach ($subscribers as $subscriberInstance) { $callback = [$subscriberInstance, $eventName]; if (is_callable($callback)) { call_user_func_array($callback, $parameters); } } } }