Adds a configurator, that can configure many services in one value
public addConfigurator ( callable $configurator ) | ||
$configurator | callable |
/** * @param IndexedServiceContainer $container */ private function setupSubscribers(IndexedServiceContainer $container) { $container->addConfigurator(function (IndexedServiceContainer $c) { array_map(array($c->get('event_dispatcher'), 'addSubscriber'), $c->getByTag('event_dispatcher.listeners')); }); }
/** * @param IndexedServiceContainer $container */ private function assembleTypePresenters(IndexedServiceContainer $container) { $container->define('formatter.presenter.value.array_type_presenter', function () { return new ArrayTypePresenter(); }, ['formatter.presenter.value']); $container->define('formatter.presenter.value.boolean_type_presenter', function () { return new BooleanTypePresenter(); }, ['formatter.presenter.value']); $container->define('formatter.presenter.value.callable_type_presenter', function (IndexedServiceContainer $c) { return new CallableTypePresenter($c->get('formatter.presenter')); }, ['formatter.presenter.value']); $container->define('formatter.presenter.value.exception_type_presenter', function () { return new BaseExceptionTypePresenter(); }, ['formatter.presenter.value']); $container->define('formatter.presenter.value.null_type_presenter', function () { return new NullTypePresenter(); }, ['formatter.presenter.value']); $container->define('formatter.presenter.value.object_type_presenter', function () { return new ObjectTypePresenter(); }, ['formatter.presenter.value']); $container->define('formatter.presenter.value.string_type_presenter', function () { return new TruncatingStringTypePresenter(new QuotingStringTypePresenter()); }, ['formatter.presenter.value']); $container->addConfigurator(function (IndexedServiceContainer $c) { array_map(array($c->get('formatter.presenter.value_presenter'), 'addTypePresenter'), $c->getByTag('formatter.presenter.value')); }); }