Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
NotifierList.php
Go to the documentation of this file.
1 <?php
8 
16 {
22  protected $objectManager;
23 
29  protected $notifiers;
30 
37 
43  {
44  $this->objectManager = $objectManager;
45  $this->notifiers = $notifiers;
46  $this->isNotifiersVerified = false;
47  }
48 
55  public function asArray()
56  {
57  if (!$this->isNotifiersVerified) {
58  $hasErrors = false;
59  foreach ($this->notifiers as $classIndex => $class) {
60  $notifier = $this->objectManager->get($class);
61  if ($notifier instanceof NotifierInterface) {
62  $this->notifiers[$classIndex] = $notifier;
63  } else {
64  $hasErrors = true;
65  unset($this->notifiers[$classIndex]);
66  }
67  }
68  $this->isNotifiersVerified = true;
69  if ($hasErrors) {
70  throw new \InvalidArgumentException('All notifiers should implement NotifierInterface');
71  }
72  }
73  return $this->notifiers;
74  }
75 }
__construct(\Magento\Framework\ObjectManagerInterface $objectManager, $notifiers=[])
$_option $_optionId $class
Definition: date.phtml:13