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


PHP SharedEventManagerInterface::detach方法代码示例

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


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

示例1: detachShared

 /**
  * {@inheritDoc}
  */
 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->listeners as $listener) {
         $events->detach(self::EVENT_IDENTIFIER, $listener);
     }
     unset($this->listeners);
 }
开发者ID:API-Skeletons,项目名称:zf-apigility-doctrine,代码行数:10,代码来源:EventCatcher.php

示例2: detachShared

 /**
  * Detach all our listeners from the event manager
  *
  * @param  SharedEventManagerInterface $events
  * @return void
  */
 public function detachShared(SharedEventManagerInterface $events)
 {
     if ($events->detach('Zend\\Mvc\\Application', $this->listener)) {
         $this->listener = null;
     }
     return true;
 }
开发者ID:webpants,项目名称:YAWIK,代码行数:13,代码来源:TokenListener.php

示例3: detachShared

 /**
  * @param SharedEventManagerInterface $events
  */
 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->sharedListeners as $index => $listener) {
         if ($events->detach('ZF\\Rest\\RestController', $listener)) {
             unset($this->sharedListeners[$index]);
         }
     }
 }
开发者ID:noc-med,项目名称:zf-rest,代码行数:11,代码来源:RestParametersListener.php

示例4: detachShared

 /**
  * @inheritdoc
  */
 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->listeners as $index => $listener) {
         if ($events->detach(AclService::class, $listener)) {
             unset($this->listeners[$index]);
         }
     }
 }
开发者ID:omusico,项目名称:zf2-demo,代码行数:11,代码来源:AclIsNotAllowedListener.php

示例5: detachShared

 public function detachShared(\Zend\EventManager\SharedEventManagerInterface $events)
 {
     foreach ($this->listeners as $index => $listener) {
         if ($events->detach($this->getMonitoredClass(), $listener)) {
             unset($this->listeners[$index]);
         }
     }
 }
开发者ID:andreas-serlo,项目名称:athene2,代码行数:8,代码来源:AbstractSharedListenerAggregate.php

示例6: detachShared

 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->sharedListeners as $index => $listener) {
         if ($events->detach($this->eventIdentifier, $listener)) {
             unset($this->sharedListeners[$index]);
         }
     }
 }
开发者ID:roelvanduijnhoven,项目名称:JwPersistentUser,代码行数:8,代码来源:WriteTokenToCookie.php

示例7: detachShared

 /**
  * @inheritdoc
  */
 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->listeners as $index => $listener) {
         if ($events->detach(AbstractActionController::class, $listener)) {
             unset($this->listeners[$index]);
         }
     }
 }
开发者ID:omusico,项目名称:zf2-demo,代码行数:11,代码来源:CheckAccessListener.php

示例8: detachShared

 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->listeners as $index => $callback) {
         if ($events->detach($id, $callback)) {
             unset($this->listeners[$index]);
         }
     }
 }
开发者ID:zend-modules,项目名称:zfc-user-rbac-doctrine-orm,代码行数:8,代码来源:NavigationListener.php

示例9: detachShared

 /**
  * {@inheritdoc}
  */
 public function detachShared(SharedEventManagerInterface $events)
 {
     foreach ($this->listeners as $id => $listener) {
         if ($events->detach($id, $listener)) {
             unset($this->listeners[$id]);
         }
     }
 }
开发者ID:Tigerlee1987,项目名称:modules.zendframework.com,代码行数:11,代码来源:LoginListener.php

示例10: detachProblemListeners

 /**
  * Detach problem listeners specified by getListenersToDetach() and return an array of information that will
  * allow them to be reattached.
  *
  * @param  SharedEvents $sharedEvents Shared event manager
  * @return array
  */
 protected function detachProblemListeners(SharedEvents $sharedEvents)
 {
     // Convert the problem list from two-dimensional array to more convenient id => event => class format:
     $formattedProblems = array();
     foreach ($this->getListenersToDetach() as $current) {
         if (!isset($formattedProblems[$current['id']])) {
             $formattedProblems[$current['id']] = array();
         }
         if (!isset($formattedProblems[$current['id']][$current['event']])) {
             $formattedProblems[$current['id']][$current['event']] = array();
         }
         $formattedProblems[$current['id']][$current['event']][] = $current['class'];
     }
     // Loop through the class blacklist, detaching problem events and remembering their CallbackHandlers
     // for future reference:
     $results = array();
     foreach ($formattedProblems as $id => $eventArray) {
         $results[$id] = array();
         foreach ($eventArray as $eventName => $classArray) {
             $results[$id][$eventName] = array();
             $events = $sharedEvents->getListeners($id, $eventName);
             foreach ($events as $currentEvent) {
                 $currentCallback = $currentEvent->getCallback();
                 if (!isset($currentCallback[0])) {
                     continue;
                 }
                 foreach ($classArray as $class) {
                     if (is_a($currentCallback[0], $class)) {
                         $sharedEvents->detach($id, $currentEvent);
                         $results[$id][$eventName][] = $currentEvent;
                     }
                 }
             }
         }
     }
     return $results;
 }
开发者ID:leonardovn86,项目名称:zf2_basic2013,代码行数:44,代码来源:Forward.php

示例11: detachProblemListeners

 /**
  * Detach problem listeners specified by getListenersToDetach() and return an array of information that will
  * allow them to be reattached.
  *
  * @param  SharedEvents $sharedEvents Shared event manager
  * @return array
  */
 protected function detachProblemListeners(SharedEvents $sharedEvents)
 {
     // Convert the problem list from two-dimensional array to more convenient id => event => class format:
     $formattedProblems = [];
     foreach ($this->getListenersToDetach() as $current) {
         if (!isset($formattedProblems[$current['id']])) {
             $formattedProblems[$current['id']] = [];
         }
         if (!isset($formattedProblems[$current['id']][$current['event']])) {
             $formattedProblems[$current['id']][$current['event']] = [];
         }
         $formattedProblems[$current['id']][$current['event']][] = $current['class'];
     }
     // Loop through the class blacklist, detaching problem events and remembering their CallbackHandlers
     // for future reference:
     $results = [];
     foreach ($formattedProblems as $id => $eventArray) {
         $results[$id] = [];
         foreach ($eventArray as $eventName => $classArray) {
             $results[$id][$eventName] = [];
             $events = $sharedEvents->getListeners($id, $eventName);
             foreach ($events as $currentEvent) {
                 $currentCallback = $currentEvent->getCallback();
                 // If we have an array, grab the object
                 if (is_array($currentCallback)) {
                     $currentCallback = array_shift($currentCallback);
                 }
                 // This routine is only valid for object callbacks
                 if (!is_object($currentCallback)) {
                     continue;
                 }
                 foreach ($classArray as $class) {
                     if ($currentCallback instanceof $class) {
                         $sharedEvents->detach($id, $currentEvent);
                         $results[$id][$eventName][] = $currentEvent;
                     }
                 }
             }
         }
     }
     return $results;
 }
开发者ID:CHRISTOPHERVANDOMME,项目名称:zf2complet,代码行数:49,代码来源:Forward.php

示例12: detachShared

 public function detachShared(\Zend\EventManager\SharedEventManagerInterface $e)
 {
     foreach ($this->listeners as $index => $listener) {
         if ($e->detach($listener)) {
             unset($this->listeners[$index]);
         }
     }
 }
开发者ID:renatosalvatori,项目名称:Zf2datatable,代码行数:8,代码来源:DatasourceListenerAggregate.php


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