* @copyright Since 2007 PrestaShop SA and Contributors * @license https://opensource.org/licenses/AFL-3.0 Academic Free License version 3.0 */ namespace PrestaShop\Module\PrestashopCheckout\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface as SymfonyComponentEventDispatcherInterface; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as SymfonyContractsEventDispatcherInterface; class SymfonyEventDispatcherAdapter implements EventDispatcherInterface { /** * @var SymfonyComponentEventDispatcherInterface */ private $eventDispatcher; /** * @param SymfonyComponentEventDispatcherInterface $eventDispatcher */ public function __construct(SymfonyComponentEventDispatcherInterface $eventDispatcher) { $this->eventDispatcher = $eventDispatcher; } /** * {@inheritdoc} */ public function dispatch($event) { if (interface_exists(SymfonyContractsEventDispatcherInterface::class) && $this->eventDispatcher instanceof SymfonyContractsEventDispatcherInterface) { // @phpstan-ignore-next-line return $this->eventDispatcher->dispatch($event, get_class($event)); } else { // @phpstan-ignore-next-line return $this->eventDispatcher->dispatch(get_class($event), $event); } } }