當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Manager::fire方法代碼示例

本文整理匯總了PHP中Phalcon\Events\Manager::fire方法的典型用法代碼示例。如果您正苦於以下問題:PHP Manager::fire方法的具體用法?PHP Manager::fire怎麽用?PHP Manager::fire使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phalcon\Events\Manager的用法示例。


在下文中一共展示了Manager::fire方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: dispatch

 public function dispatch(Command $command)
 {
     //If beforeCommand fails abort
     if ($this->_eventsManager->fire('command:beforeCommand', $command) === false) {
         return false;
     }
     //If run the commands fails abort too
     if ($command->run($command->getParameters()) === false) {
         return false;
     }
     $this->_eventsManager->fire('command:afterCommand', $command);
 }
開發者ID:TommyAzul,項目名稱:docker-centos6,代碼行數:12,代碼來源:Script.php

示例2: testListenDispatchEvents

 public function testListenDispatchEvents()
 {
     $dispatcherMock = $this->getMockBuilder(Dispatcher::class)->disableOriginalConstructor()->getMock();
     $listener = $this->getMockBuilder(ListenerDispatch::class)->getMock();
     $listener->expects($this->once())->method('beforeDispatchLoop');
     $listener->expects($this->once())->method('beforeExecuteRoute');
     //        $listener->expects($this->once())
     //                ->method('afterExecuteRoute');
     //        $listener->expects($this->once())
     //                ->method('beforeNotFoundAction');
     //        $listener->expects($this->once())
     //                ->method('beforeException');
     //        $listener->expects($this->once())
     //                ->method('afterDispatchLoop');
     $this->listener->listenDispatchEvents($listener);
     $this->em->fire('dispatch:beforeDispatchLoop', $dispatcherMock, null);
     $this->em->fire('dispatch:beforeExecuteRoute', $dispatcherMock, null);
     //        $this->em->fire('dispatch:afterExecuteRoute', $dispatcherMock, null);
     //        $this->em->fire('dispatch:beforeNotFoundAction', $dispatcherMock, null);
     //        $this->em->fire('dispatch:beforeException', $dispatcherMock, null);
     //        $this->em->fire('dispatch:afterDispatchLoop', $dispatcherMock, null);
 }
開發者ID:tmquang6805,項目名稱:phalex,代碼行數:22,代碼來源:ListenerTest.php

示例3: render

 /**
  * Renders output file using renderer object
  *
  * @throws InvalidRendererException
  * @return string
  */
 public function render()
 {
     if ($this->eventsManager instanceof ManagerInterface) {
         $this->eventsManager->fire('generator:beforeRender', $this);
     }
     if (!$this->renderer instanceof RendererInterface) {
         throw new InvalidRendererException();
     }
     $output = $this->renderer->render();
     if ($this->eventsManager instanceof ManagerInterface) {
         $this->eventsManager->fire('generator:afterRender', $this);
     }
     return $output;
 }
開發者ID:vegas-cmf,項目名稱:apidoc,代碼行數:20,代碼來源:Generator.php

示例4: fire

 public static function fire($eventType, $source, $data = null, $cancelable = true)
 {
     static::$event or static::$event = static::$di->getShared('eventsManager');
     return static::$event->fire($eventType, $source, $data, $cancelable);
 }
開發者ID:phwoolcon,項目名稱:phwoolcon,代碼行數:5,代碼來源:Events.php

示例5: EventsManager

<?php

use Phalcon\Events\Manager as EventsManager;
$evManager = new EventsManager();
//Set up the events manager to collect responses
$evManager->collectResponses(true);
//Attach a listener
$evManager->attach('custom:custom', function () {
    return 'first response';
});
//Attach a listener
$evManager->attach('custom:custom', function () {
    return 'second response';
});
//Fire the event
$evManager->fire('custom:custom', null);
//Get all the collected responses
print_r($evManager->getResponses());
開發者ID:aodkrisda,項目名稱:phalcon-code,代碼行數:18,代碼來源:events-345.php


注:本文中的Phalcon\Events\Manager::fire方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。