当前位置: 首页>>代码示例>>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;未经允许,请勿转载。