Пример #1
0
 /**
  * @param ContainerInterface $dic
  *
  * @throws \InvalidArgumentException
  */
 public function wire(ContainerInterface $dic)
 {
     if (empty($dic['Yapeal.Event.EveApiEvent'])) {
         $dic['Yapeal.Event.EveApi'] = $dic->factory(function ($dic) {
             return new $dic['Yapeal.Event.Factories.eveApi']();
         });
     }
     if (empty($dic['Yapeal.Event.LogEvent'])) {
         $dic['Yapeal.Event.LogEvent'] = $dic->factory(function ($dic) {
             return new $dic['Yapeal.Event.Factories.log']();
         });
     }
     if (empty($dic['Yapeal.Event.Mediator'])) {
         $dic['Yapeal.Event.Mediator'] = function ($dic) {
             return new $dic['Yapeal.Event.Handlers.mediator']($dic);
         };
     }
 }
Пример #2
0
 /**
  * @param ContainerInterface $dic
  *
  * @throws \InvalidArgumentException
  * @throws \LogicException
  */
 public function wire(ContainerInterface $dic)
 {
     if (empty($dic['Yapeal.Xml.Data'])) {
         $dic['Yapeal.Xml.Data'] = $dic->factory(function ($dic) {
             return new $dic['Yapeal.Xml.Handlers.data']();
         });
     }
     if (empty($dic['Yapeal.Xml.Error.Subscriber'])) {
         $dic['Yapeal.Xml.Error.Subscriber'] = function () use($dic) {
             return new $dic['Yapeal.Xml.Handlers.error']();
         };
     }
     if (empty($dic['Yapeal.Event.Mediator'])) {
         $mess = 'Tried to call Mediator before it has been added';
         throw new \LogicException($mess);
     }
     /**
      * @var \Yapeal\Event\MediatorInterface $mediator
      */
     $mediator = $dic['Yapeal.Event.Mediator'];
     $mediator->addServiceListener('Yapeal.Xml.Error.start', ['Yapeal.Xml.Error.Subscriber', 'processXmlError'], 'last');
 }