当前位置: 首页>>代码示例>>PHP>>正文


PHP EventDispatcherInterface::addSubscriber方法代码示例

本文整理汇总了PHP中Symfony\Component\EventDispatcher\EventDispatcherInterface::addSubscriber方法的典型用法代码示例。如果您正苦于以下问题:PHP EventDispatcherInterface::addSubscriber方法的具体用法?PHP EventDispatcherInterface::addSubscriber怎么用?PHP EventDispatcherInterface::addSubscriber使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Symfony\Component\EventDispatcher\EventDispatcherInterface的用法示例。


在下文中一共展示了EventDispatcherInterface::addSubscriber方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: subscribe

 public function subscribe(Container $c, EventDispatcherInterface $dispatcher)
 {
     $dispatcher->addSubscriber($c['extra.controller_listener']);
     $dispatcher->addSubscriber($c['extra.paramconverter_listener']);
     $dispatcher->addSubscriber($c['extra.httpcache_listener']);
     $dispatcher->addSubscriber($c['extra.security_listener']);
 }
开发者ID:brodaproject,项目名称:broda,代码行数:7,代码来源:FrameworkExtraProvider.php

示例2: subscribe

 public function subscribe(Container $app, EventDispatcherInterface $dispatcher)
 {
     $dispatcher->addSubscriber(new ResponseListener($app['charset']));
     $dispatcher->addSubscriber(new MiddlewareListener($app['app']));
     $dispatcher->addSubscriber(new ConverterListener($app['routes'], $app['callback_resolver']));
     $dispatcher->addSubscriber(new StringToResponseListener());
 }
开发者ID:formula9,项目名称:framework,代码行数:7,代码来源:NineKernelServiceProvider.php

示例3: addSubscriber

 /**
  * {@inheritDoc}
  */
 public function addSubscriber(EventSubscriberInterface $subscriber)
 {
     if (!$this->primaryEventDispatcher) {
         throw new \RuntimeException('Undefined primary event dispatcher');
     }
     $this->primaryEventDispatcher->addSubscriber($subscriber);
 }
开发者ID:Gtvar,项目名称:FivePercent-ApiBundle,代码行数:10,代码来源:ChainEventDispatcher.php

示例4: bindRequestListeners

 private function bindRequestListeners(Application $app, EventDispatcherInterface $dispatcher)
 {
     $dispatcher->addSubscriber($app['alchemy_rest.decode_request_listener']);
     $dispatcher->addSubscriber($app['alchemy_rest.paginate_request_listener']);
     $dispatcher->addSubscriber($app['alchemy_rest.sort_request_listener']);
     $dispatcher->addSubscriber($app['alchemy_rest.date_request_listener']);
 }
开发者ID:bburnichon,项目名称:rest-bundle,代码行数:7,代码来源:RestProvider.php

示例5: build

 /**
  * {@inheritdoc}
  */
 public function build(ImporterTypeInterface $type, Import $import, HandlerInterface $handler, ImportLogger $logger, array $options)
 {
     $resolver = $this->getOptionsResolver($type);
     $type->build($this, $import, $handler, $resolver->resolve($options));
     $importer = new Importer($import, $handler, $logger, $this->eventDispatcher);
     $this->eventDispatcher->addSubscriber($importer);
     return $importer;
 }
开发者ID:mvanduijker,项目名称:FMIoBundle,代码行数:11,代码来源:ImporterBuilder.php

示例6: subscribe

 /**
  * Define events to listen to here.
  *
  * @param EventDispatcherInterface $dispatcher
  */
 protected function subscribe(EventDispatcherInterface $dispatcher)
 {
     $app = $this->getContainer();
     $dispatcher->addSubscriber($this);
     $dispatcher->addSubscriber($app['members.admin']);
     $dispatcher->addSubscriber($app['members.session']);
     $dispatcher->addSubscriber($app['members.listener.profile']);
 }
开发者ID:bolt,项目名称:Members,代码行数:13,代码来源:MembersExtension.php

示例7: __construct

 /**
  * @param Import                   $import
  * @param HandlerInterface         $handler
  * @param EventDispatcherInterface $dispatcher
  * @param int                      $batchSize
  */
 public function __construct(Import $import, HandlerInterface $handler, EventDispatcherInterface $dispatcher, $batchSize = 20)
 {
     $this->import = $import;
     $this->handler = $handler;
     $this->eventDispatcher = $dispatcher;
     $this->result = new ImportResult();
     $this->setBatchSize($batchSize);
     $this->eventDispatcher->addSubscriber($this);
 }
开发者ID:treehouselabs,项目名称:io-bundle,代码行数:15,代码来源:Importer.php

示例8: attachTo

 /**
  * @param FileLibrary $filelib
  */
 public function attachTo(FileLibrary $filelib)
 {
     $this->fileRepository = $filelib->getFileRepository();
     $this->profiles = $filelib->getProfileManager();
     $this->eventDispatcher = $filelib->getEventDispatcher();
     $this->eventDispatcher->addSubscriber($this);
     $this->adapter->attachTo($filelib);
     $this->linker->attachTo($filelib);
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:12,代码来源:Publisher.php

示例9: addAnnotationHandler

 /**
  * @param AnnotationHandlerInterface $handler
  * @return $this
  * @throws \InvalidArgumentException
  */
 public function addAnnotationHandler(AnnotationHandlerInterface $handler)
 {
     if (isset($this->annotationHandlers[$handler->getName()])) {
         throw new \InvalidArgumentException($handler->getName() . ' is already registered');
     }
     $this->annotationHandlers[$handler->getName()] = $handler;
     $this->dispatcher->addSubscriber($handler);
     return $this;
 }
开发者ID:thewunder,项目名称:croute,代码行数:14,代码来源:Router.php

示例10: __invoke

 /**
  * {@inheritdoc}
  */
 public function __invoke(Request $request)
 {
     $context = new RequestContext();
     $context->fromRequest($request);
     $this->eventDispatcher->addSubscriber(new RouterListener(new UrlMatcher($this->routeCollection, $context)));
     $kernel = new HttpKernel($this->eventDispatcher, new ControllerResolverActionResolverAdapter($this->actionResolver));
     $response = $kernel->handle($request);
     $response->send();
     $kernel->terminate($request, $response);
 }
开发者ID:cotapreco,项目名称:kernel,代码行数:13,代码来源:Application.php

示例11: create

 public function create($formatter, Platform $platform, $options = array())
 {
     $formatter = strtolower($formatter);
     if (isset(self::$formatters[$formatter]) === false) {
         throw new EngineException('Formatter does not exist at::' . $formatter);
     }
     $class = new self::$formatters[$formatter]($this->event, $this->writer->getWriter($platform->getName(), $formatter), $platform, $this->visitor, $options);
     # register this formatter as a subscriber
     $this->event->addSubscriber($class);
     return $class;
 }
开发者ID:icomefromthenet,项目名称:faker,代码行数:11,代码来源:FormatterFactory.php

示例12: addProfile

 /**
  * Adds a profile
  *
  * @param FileProfile $profile
  * @return ProfileManager
  * @throws InvalidArgumentException
  */
 public function addProfile(FileProfile $profile)
 {
     $identifier = $profile->getIdentifier();
     if (isset($this->profiles[$identifier])) {
         throw new InvalidArgumentException("Profile '{$identifier}' already exists");
     }
     $this->profiles[$identifier] = $profile;
     $this->eventDispatcher->addSubscriber($profile);
     $event = new FileProfileEvent($profile);
     $this->eventDispatcher->dispatch(Events::PROFILE_AFTER_ADD, $event);
     return $this;
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:19,代码来源:ProfileManager.php

示例13: setUp

 public function setUp()
 {
     parent::setUp();
     $this->siteAccess = new SiteAccess();
     $this->dispatcher = $this->getMock('Symfony\\Component\\EventDispatcher\\EventDispatcherInterface');
     $this->listener = new ConsoleCommandListener('default', $this->siteAccessList, $this->dispatcher);
     $this->listener->setSiteAccess($this->siteAccess);
     $this->dispatcher->addSubscriber($this->listener);
     $this->command = new Command('test:siteaccess');
     $this->inputDefinition = new InputDefinition(array(new InputOption('siteaccess', null, InputOption::VALUE_OPTIONAL)));
     $this->testOutput = new TestOutput(Output::VERBOSITY_QUIET, true);
 }
开发者ID:ezsystems,项目名称:ezpublish-kernel,代码行数:12,代码来源:ConsoleCommandListenerTest.php

示例14: boot

 /**
  * @param EventDispatcherInterface $dispatcher
  */
 public function boot(EventDispatcherInterface $dispatcher)
 {
     $context = new PhpGdContext();
     $rh = new ResourceHelper();
     $extractor = new GifExtractor();
     $builder = new GifBuilder();
     $builderPlus = new GifBuilderPlus();
     $optimizer = new GifOptimizer($rh);
     $factory = new ImageFactory($rh, $extractor, $builder, $builderPlus, $optimizer);
     $dispatcher->addSubscriber(new GifExtractorListener($extractor));
     $dispatcher->addSubscriber(new MemoryRequirementListener($context));
     $dispatcher->addSubscriber(new ImageFactoryListener($factory));
 }
开发者ID:MagiChain,项目名称:imagecraft,代码行数:16,代码来源:GifExtension.php

示例15: addPlugin

 /**
  * @param Plugin $plugin
  * @param array $profiles Profiles to add to, empty array to add to all profiles
  * @param string $name
  * @return PluginManager
  */
 public function addPlugin(Plugin $plugin, $profiles = array(), $name = null)
 {
     if (!$name) {
         $name = $this->generatePluginName($plugin);
     }
     if (isset($this->plugins[$name])) {
         throw new InvalidArgumentException(sprintf("Plugin with the name '%s' already exists", $name));
     }
     $this->plugins[$name] = $plugin;
     $this->setResolverFunction($plugin, $profiles);
     $this->eventDispatcher->addSubscriber($plugin);
     $event = new PluginEvent($plugin, $this->filelib);
     $this->eventDispatcher->dispatch(Events::PLUGIN_AFTER_ADD, $event);
     return $this;
 }
开发者ID:kankje,项目名称:xi-filelib,代码行数:21,代码来源:PluginManager.php


注:本文中的Symfony\Component\EventDispatcher\EventDispatcherInterface::addSubscriber方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。