當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。