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


PHP EventDispatcherInterface::removeListener方法代码示例

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


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

示例1: createGrid

 /**
  * @ActivityListQueryDesigner $queryDesigner
  *
  * @return DatagridInterface
  */
 public function createGrid(ActivityListQueryDesigner $source)
 {
     $this->datagridConfigurationBuilder->setGridName('related-activity');
     $this->datagridConfigurationBuilder->setSource($source);
     $config = $this->datagridConfigurationBuilder->getConfiguration();
     $stopPropagationListener = function (Event $e) {
         $e->stopPropagation();
     };
     $this->eventDispatcher->addListener(BuildBefore::NAME, $stopPropagationListener, 255);
     $grid = $this->gridBuilderLink->getService()->build($config, new ParameterBag());
     $this->eventDispatcher->removeListener(BuildBefore::NAME, $stopPropagationListener);
     return $grid;
 }
开发者ID:Maksold,项目名称:platform,代码行数:18,代码来源:DatagridHelper.php

示例2: detachEvents

 public function detachEvents()
 {
     foreach ($this->attachedEvents as $eventInfo) {
         $this->eventDispatcher->removeListener($eventInfo['key'], $eventInfo['callback']);
     }
     $this->attachedEvents = [];
 }
开发者ID:jarves,项目名称:jarves,代码行数:7,代码来源:JarvesEventDispatcher.php

示例3: removeEventListener

 /**
  * Removes an event listener for the given event name.
  *
  * @param string   $eventName The event name.
  * @param callable $listener  The callback to remove.
  *
  * @return static The current instance.
  *
  * @see EventDispatcherInterface::removeListener()
  */
 public function removeEventListener($eventName, $listener)
 {
     if (!$this->dispatcher) {
         $this->dispatcher = new EventDispatcher();
     }
     $this->dispatcher->removeListener($eventName, $listener);
     return $this;
 }
开发者ID:webmozart,项目名称:console,代码行数:18,代码来源:ApplicationConfig.php

示例4: activate

 /**
  * Activate cross processes tunnel.
  * NB: Should be called only in child process!
  * Removes all current registered listeners.
  */
 public function activate()
 {
     foreach ($this->dispatcher->getListeners() as $event => $listeners) {
         foreach ($listeners as $listener) {
             $this->dispatcher->removeListener($event, $listener);
         }
     }
     foreach ($this->events as $event) {
         $this->dispatcher->addListener($event, [$this, 'onEvent']);
     }
     foreach ($this->sockets as $socket) {
         fclose($socket);
     }
     fclose($this->childSocket);
 }
开发者ID:komex,项目名称:unteist,代码行数:20,代码来源:Connector.php

示例5: __invoke

 public function __invoke(FilterResponseEvent $event, $eventName, EventDispatcherInterface $dispatcher)
 {
     $request = $event->getRequest();
     $response = $event->getResponse();
     $session = $this->getSession();
     /** @var ApiOauthToken $token */
     $token = $session->get('token');
     $this->getApiLogManipulator()->create($token->getAccount(), $request, $response);
     $this->getApiOAuthTokenManipulator()->setLastUsed($token, new \DateTime());
     $session->set('token', null);
     if (null !== $this->getAuthenticator()->getUser()) {
         $this->getAuthenticator()->closeAccount();
     }
     $dispatcher->removeListener($eventName, $this);
 }
开发者ID:luisbrito,项目名称:Phraseanet,代码行数:15,代码来源:OAuthResponseListener.php

示例6: unregister

 /**
  * Unregisters the dispatcher.
  *
  * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance
  */
 public function unregister(EventDispatcherInterface $dispatcher)
 {
     $dispatcher->removeListener(KernelEvents::EXCEPTION, array($this, 'onKernelException'));
 }
开发者ID:tahermarkos,项目名称:Transport,代码行数:9,代码来源:ExceptionListener.php

示例7: flushHandlers

 /**
  * Flush handlers.
  *
  * Clears all handlers.
  *
  * @return void
  */
 public function flushHandlers()
 {
     foreach ($this->dispatcher->getListeners() as $eventName => $listener) {
         $this->dispatcher->removeListener($eventName, $listener);
     }
 }
开发者ID:rmaiwald,项目名称:core,代码行数:13,代码来源:HookDispatcher.php

示例8: removeListener

 /**
  * @inheritdoc
  */
 public function removeListener($eventName, callable $listener)
 {
     $this->dispatcher->removeListener($eventName, $listener);
 }
开发者ID:ldaptools,项目名称:ldaptools,代码行数:7,代码来源:SymfonyEventDispatcher.php

示例9: removeListener

 /**
  * Removes an event listener from the specified events.
  *
  * @param string|array $eventName The event(s) to remove a listener from.
  *
  * @param callable     $listener  The listener to remove.
  *
  * @return void
  */
 public function removeListener($eventName, $listener)
 {
     $this->realDispatcher->removeListener($eventName, $listener);
 }
开发者ID:cyberspectrum,项目名称:contao-debugger,代码行数:13,代码来源:DebuggedEventDispatcher.php

示例10: removeListener

 /**
  * {@inheritdoc}
  */
 public function removeListener($eventName, $listener)
 {
     return $this->dispatcher->removeListener($eventName, $listener);
 }
开发者ID:itkg,项目名称:profiler,代码行数:7,代码来源:TraceableEventDispatcher.php

示例11: removeListener

 /**
  * Removes an event listener from the specified events.
  *
  * @param string   $eventName The event to remove a listener from
  * @param callable $listenerToBeRemoved The listener to remove
  */
 public function removeListener($eventName, $listenerToBeRemoved)
 {
     $this->symfonyDispatcher->removeListener($eventName, $listenerToBeRemoved);
 }
开发者ID:luizpcam,项目名称:laravel,代码行数:10,代码来源:EventDispatcherAdapter.php

示例12: configure

 /**
  * Configures the error handler.
  *
  * @param Event|null                    $event           The triggering event
  * @param string|null                   $eventName       The triggering event name
  * @param EventDispatcherInterface|null $eventDispatcher The dispatcher used to trigger $event
  */
 public function configure(Event $event = null, $eventName = null, EventDispatcherInterface $eventDispatcher = null)
 {
     if (null !== $eventDispatcher) {
         foreach (array_keys(static::getSubscribedEvents()) as $name) {
             $eventDispatcher->removeListener($name, array($this, 'configure'));
         }
     }
     $handler = set_error_handler('var_dump', 0);
     $handler = is_array($handler) ? $handler[0] : null;
     restore_error_handler();
     if ($handler instanceof ErrorHandler) {
         if ($this->logger) {
             $handler->setDefaultLogger($this->logger, $this->levels);
             if (is_array($this->levels)) {
                 $scream = 0;
                 foreach ($this->levels as $type => $log) {
                     $scream |= $type;
                 }
             } else {
                 $scream = null === $this->levels ? E_ALL | E_STRICT : $this->levels;
             }
             if ($this->scream) {
                 $handler->screamAt($scream);
             }
             $this->logger = $this->levels = null;
         }
         if (null !== $this->throwAt) {
             $handler->throwAt($this->throwAt, true);
         }
     }
     if (!$this->exceptionHandler) {
         if ($event instanceof KernelEvent) {
             $this->exceptionHandler = array($event->getKernel(), 'terminateWithException');
         } elseif ($event instanceof ConsoleEvent && ($app = $event->getCommand()->getApplication())) {
             $output = $event->getOutput();
             if ($output instanceof ConsoleOutputInterface) {
                 $output = $output->getErrorOutput();
             }
             $this->exceptionHandler = function ($e) use($app, $output) {
                 $app->renderException($e, $output);
             };
         }
     }
     if ($this->exceptionHandler) {
         $handler = set_exception_handler('var_dump');
         $handler = is_array($handler) ? $handler[0] : null;
         restore_exception_handler();
         if ($handler instanceof ErrorHandler) {
             $h = $handler->setExceptionHandler('var_dump') ?: $this->exceptionHandler;
             $handler->setExceptionHandler($h);
             $handler = is_array($h) ? $h[0] : null;
         }
         if ($handler instanceof ExceptionHandler) {
             $handler->setHandler($this->exceptionHandler);
             if (null !== $this->fileLinkFormat) {
                 $handler->setFileLinkFormat($this->fileLinkFormat);
             }
         }
         $this->exceptionHandler = null;
     }
 }
开发者ID:vomasmic,项目名称:symfony,代码行数:68,代码来源:DebugHandlersListener.php

示例13: __invoke

 /**
  * Invoke the handler.
  *
  * @param Event                    $event      The event.
  *
  * @param string                   $eventName  The event name.
  *
  * @param EventDispatcherInterface $dispatcher The dispatcher.
  *
  * @return void
  */
 public function __invoke(Event $event, $eventName, $dispatcher)
 {
     $dispatcher->removeListener($eventName, $this);
     call_user_func($this->handler, $event, $eventName, $dispatcher);
 }
开发者ID:zonky2,项目名称:core,代码行数:16,代码来源:DelayedEvent.php


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