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