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


PHP Event::isStopped方法代码示例

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


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

示例1: testPropagation

 /**
  * Tests the event propagation stopping property
  *
  * @return void
  * @triggers fake.event
  */
 public function testPropagation()
 {
     $event = new Event('fake.event');
     $this->assertFalse($event->isStopped());
     $event->stopPropagation();
     $this->assertTrue($event->isStopped());
 }
开发者ID:JesseDarellMoore,项目名称:CS499,代码行数:13,代码来源:EventTest.php

示例2: dispatch

 /**
  * Dispatches a new event to all configured listeners
  *
  * @param string|\Cake\Event\Event $event the event key name or instance of Event
  * @return \Cake\Event\Event
  * @triggers $event
  */
 public function dispatch($event)
 {
     if (is_string($event)) {
         $event = new Event($event);
     }
     $listeners = $this->listeners($event->name());
     if (empty($listeners)) {
         return $event;
     }
     foreach ($listeners as $listener) {
         if ($event->isStopped()) {
             break;
         }
         $result = $this->_callListener($listener['callable'], $event);
         if ($result === false) {
             $event->stopPropagation();
         }
         if ($result !== null) {
             $event->result = $result;
         }
     }
     return $event;
 }
开发者ID:ansidev,项目名称:cakephp_blog,代码行数:30,代码来源:EventManager.php

示例3: buildValidator

 /**
  * Automatically add the translated validation rules if the event is not stopped
  * and if the name of the validator is amongst the accepted ones.
  *
  * @source http://book.cakephp.org/3.0/en/core-libraries/validation.html#validating-data
  *
  * @param \Cake\Event\Event $event Fired when the validator object identified by $name is being built.
  * @param \Cake\Validation\Validator $validator The validator object
  * @param string $name The name of the validator oject
  * @return void
  */
 public function buildValidator(\Cake\Event\Event $event, \Cake\Validation\Validator $validator, $name)
 {
     $accepted = $this->config('accepted');
     if ($event->isStopped() === false && ($accepted === null || in_array($name, (array) $accepted))) {
         foreach ($this->getValidationRules() as $validationRule) {
             call_user_func_array([$validator, 'add'], $validationRule);
         }
     }
 }
开发者ID:jmjjg,项目名称:cakephp-postgres,代码行数:20,代码来源:AutovalidateBehavior.php


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