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