/
githubmirror
/
magento2
Обзор
Документация
Войти
/
githubmirror
/
magento2
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
2.4-develop
lib/internal/Magento/Framework/Notification/NotifierList.php
75 строк
2 KB
Alexandra Zota
ACP2E-4019: CE copyright updates for 2.4.9-beta1
22 окт 2025, 17:47
22 окт 2025, 17:47
1b769b7
Код
Авторство
О чём код?
<?php /** * Copyright 2014 Adobe * All Rights Reserved. */ namespace Magento\Framework\Notification; /** * List of registered system notifiers * @api * * @since 100.0.2 */ class NotifierList { /** * Object manager * * @var \Magento\Framework\ObjectManagerInterface */ protected $objectManager; /** * List of notifiers * * @var NotifierInterface[]|string[] */ protected $notifiers; /** * Whether the list of notifiers is verified (all notifiers should implement NotifierInterface interface) * * @var bool */ protected $isNotifiersVerified; /** * @param \Magento\Framework\ObjectManagerInterface $objectManager * @param NotifierInterface[]|string[] $notifiers */ public function __construct(\Magento\Framework\ObjectManagerInterface $objectManager, $notifiers = []) { $this->objectManager = $objectManager; $this->notifiers = $notifiers; $this->isNotifiersVerified = false; } /** * Returning list of notifiers. * * @return NotifierInterface[] * @throws \InvalidArgumentException */ public function asArray() { if (!$this->isNotifiersVerified) { $hasErrors = false; foreach ($this->notifiers as $classIndex => $class) { $notifier = $this->objectManager->get($class); if ($notifier instanceof NotifierInterface) { $this->notifiers[$classIndex] = $notifier; } else { $hasErrors = true; unset($this->notifiers[$classIndex]); } } $this->isNotifiersVerified = true; if ($hasErrors) { throw new \InvalidArgumentException('All notifiers should implement NotifierInterface'); } } return $this->notifiers; } }