/** * @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); }; } }
/** * @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'); }
/** * @param \PhpSpec\Wrapper\Collaborator|\Yapeal\Container\ContainerInterface $dic */ public function let(ContainerInterface $dic) { $dic->keys(); $this->beAnInstanceOf('\\Spec\\Yapeal\\Sql\\MockPreserver'); $this->sxe = new \SimpleXMLElement($this->testCorpSheet); }
/** * Uses Sql section settings to make a filtered list of replacement pairs for SQL statements. * * @param ContainerInterface $dic * * @return array */ protected function getSqlSubs(ContainerInterface $dic) { $keys = $dic->keys(); $platform = '.' . $dic['Yapeal.Sql.platform']; /** * @var array $filteredKeys */ $filteredKeys = array_filter($keys, function ($key) use($platform) { if (0 !== strpos($key, 'Yapeal.Sql.')) { return false; } $filtered = in_array($key, ['Yapeal.Sql.CommonQueries', 'Yapeal.Sql.Connection', 'Yapeal.Sql.Creator'], true) || false !== strpos($key, 'Handlers.') || false !== strpos($key, 'Platforms.') && false === strpos($key, $platform); return !$filtered; }); $replacements = []; foreach ($filteredKeys as $key) { $subName = '{' . substr($key, strrpos($key, '.') + 1) . '}'; $replacements[$subName] = $dic[$key]; } return $replacements; }
/** * @param \PhpSpec\Wrapper\Collaborator|\Yapeal\Container\ContainerInterface $dic */ public function let(ContainerInterface $dic) { $dic->keys(); $this->beAnInstanceOf('\\Spec\\Yapeal\\Sql\\MockSqlSubs'); }