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


PHP Manager::dispatch方法代码示例

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


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

示例1: testDispatch

 public function testDispatch()
 {
     $event = new Event('banane', $this);
     $manager = new Manager();
     $this->assertEquals(array(), $manager->getSubscribers($event));
     // nix passiert
     $manager->dispatch($event);
     $subscriber = $this->getMock('Psc\\Code\\Event\\SubscriberMock', array('trigger'));
     // Set up the expectation for the update() method
     // to be called only once and with the string 'something'
     // as its parameter.
     $subscriber->expects($this->once())->method('trigger')->with($this->equalTo($event));
     /* bind unseren Subscriber an ddas Event */
     $manager->bind($subscriber, 'banane');
     $this->assertEquals(1, count($manager->getSubscribers($event)));
     /* soll dingsen */
     $manager->dispatch($event);
 }
开发者ID:pscheit,项目名称:psc-cms,代码行数:18,代码来源:ManagerTest.php

示例2: dirname

    ob_start("ob_gzhandler");
} else {
    ob_start();
}
//les managers ne renvoient QUE du json, on met donc le header de la réponse a jour
//on inclu l'autoloader
include dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoloader.php';
$manager = new Manager();
//on récupère la commande et la parse pour être executée
if (isset($_POST['command'])) {
    $commands = explode(':', $_POST['command']);
    $managerName = $commands[0];
    $managerCommand = $commands[1];
    //on supprime la commande de la variable globale, les managers n'ont pas a la connaitre et a l'utiliser
    unset($_POST['command']);
    //si on trouve la commande on l'execute
    if ($manager->match($managerName, $managerCommand)) {
        $manager->dispatch($_POST);
    } else {
        $response = json_encode(['result' => false, 'message' => "commande inexistante"]);
        $objectResponse = new Response(404);
        $objectResponse->write($response);
        $objectResponse->send();
    }
} else {
    $response = json_encode(['result' => false, 'message' => "Variable POST command inexistante"]);
    $objectResponse = new Response(404);
    $objectResponse->write($response);
    $objectResponse->send();
}
ob_end_clean();
开发者ID:xdrm-brackets,项目名称:projetphp,代码行数:31,代码来源:index.php

示例3: dirname

//variable globale pour accéder aux dossiers des managers
$GLOBALS['managers_dir'] = dirname(__FILE__);
session_start();
if ($GLOBALS['compression']) {
    ob_start("ob_gzhandler");
} else {
    ob_start();
}
//les managers ne renvoient QUE du json, on met donc le header de la réponse a jour
//header('Content-Type: application/json');
//on inclu l'autoloader
include dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'autoloader.php';
$manager = new Manager();
//on récupère la commande et la parse pour être executée
$json = json_decode($_POST['json'], true);
$command = $json['command'];
if (isset($command)) {
    $commands = explode(':', $command);
    $managerName = $commands[0];
    $managerCommand = $commands[1];
    //si on trouve la commande on l'execute
    if ($manager->match($managerName, $managerCommand)) {
        $manager->dispatch($json);
    } else {
        $response = json_encode(['result' => "commande inexistante"]);
        $objectResponse = new Response(404);
        $objectResponse->write($response);
        $objectResponse->send();
    }
}
ob_end_clean();
开发者ID:xdrm-brackets,项目名称:intothewhile,代码行数:31,代码来源:index.php


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