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


PHP Routing\DispatcherFactory类代码示例

本文整理汇总了PHP中Cake\Routing\DispatcherFactory的典型用法代码示例。如果您正苦于以下问题:PHP DispatcherFactory类的具体用法?PHP DispatcherFactory怎么用?PHP DispatcherFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     DispatcherFactory::clear();
     $this->_init();
     unset($this->RequestHandler, $this->Controller);
 }
开发者ID:Rabp9,项目名称:test-psi2,代码行数:12,代码来源:RequestHandlerComponentTest.php

示例2: tearDown

 /**
  * tearDown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     Plugin::unload();
     DispatcherFactory::clear();
     $this->Case->controller = null;
 }
开发者ID:maitrepylos,项目名称:nazeweb,代码行数:12,代码来源:ControllerTestCaseTest.php

示例3: testDispatcherFactoryCompat

 /**
  * Ensure that filters connected to the DispatcherFactory are
  * also applied
  */
 public function testDispatcherFactoryCompat()
 {
     $filter = $this->getMock('Cake\\Routing\\DispatcherFilter', ['beforeDispatch', 'afterDispatch']);
     DispatcherFactory::add($filter);
     $dispatcher = new ActionDispatcher();
     $this->assertCount(1, $dispatcher->getFilters());
     $this->assertSame($filter, $dispatcher->getFilters()[0]);
 }
开发者ID:markstory,项目名称:cakephp-spekkoek,代码行数:12,代码来源:ActionDispatcherTest.php

示例4: __construct

 /**
  * @param \Spekkoek\ControllerFactory $factory A controller factory instance.
  */
 public function __construct($factory = null)
 {
     // Compatibility with DispatcherFilters.
     foreach (DispatcherFactory::filters() as $filter) {
         $this->addFilter($filter);
     }
     $this->factory = $factory ?: new ControllerFactory();
 }
开发者ID:markstory,项目名称:cakephp-spekkoek,代码行数:11,代码来源:ActionDispatcher.php

示例5: tearDown

 /**
  * tearDown method
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     DispatcherFactory::clear();
     Router::reload();
     Router::$initialized = false;
     unset($this->RequestHandler, $this->Controller);
 }
开发者ID:Slayug,项目名称:castor,代码行数:13,代码来源:RequestHandlerComponentTest.php

示例6: execute

 /**
  * Run a request and get the response.
  *
  * @param array $request The request context to execute.
  * @return \Cake\Network\Response The generated response.
  */
 public function execute($request)
 {
     $request = new Request($request);
     $response = new Response();
     $dispatcher = DispatcherFactory::create();
     $dispatcher->eventManager()->on('Dispatcher.invokeController', ['priority' => 999], [$this->_test, 'controllerSpy']);
     $dispatcher->dispatch($request, $response);
     return $response;
 }
开发者ID:nrother,项目名称:cakephp,代码行数:15,代码来源:LegacyRequestDispatcher.php

示例7: setUp

 /**
  * Setup method
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     Configure::write('App.namespace', 'TestApp');
     Router::connect('/:controller/:action/*', [], ['routeClass' => 'InflectedRoute']);
     DispatcherFactory::clear();
     DispatcherFactory::add('Routing');
     DispatcherFactory::add('ControllerFactory');
 }
开发者ID:kfer10,项目名称:excel,代码行数:14,代码来源:IntegrationTestCaseTest.php

示例8: index

 /**
  * Catch all for Opauth
  * Handling callback
  */
 public function index()
 {
     $this->_loadOpauth();
     try {
         $callback = ['validated' => true, 'response' => $this->Opauth->run()];
     } catch (OpauthException $e) {
         $callback = ['validated' => false, 'message' => $e->getMessage(), 'code' => $e->getCode()];
     }
     $Request = new Request(Configure::read('Opauth.CompleteURL'));
     $Request->data = $callback;
     $dispatcher = DispatcherFactory::create();
     $dispatcher->dispatch($Request, new Response());
     exit;
 }
开发者ID:00F100,项目名称:cakephp-opauth,代码行数:18,代码来源:OpauthController.php

示例9: CakeRatchetFilter

<?php

use Cake\Core\Configure;
use Cake\Event\EventManager;
use Cake\Routing\DispatcherFactory;
use Cake\Routing\Router;
use CakeRatchet\Routing\Filter\CakeRatchetFilter;
$debugBar = new CakeRatchetFilter(EventManager::instance());
DispatcherFactory::add($debugBar);
开发者ID:rapsspider,项目名称:cake_ratchet,代码行数:9,代码来源:bootstrap.php

示例10: tearDown

 /**
  * teardown
  *
  * @return void
  */
 public function tearDown()
 {
     parent::tearDown();
     DispatcherFactory::clear();
     Router::reload();
 }
开发者ID:Slayug,项目名称:castor,代码行数:11,代码来源:RequestActionTraitTest.php

示例11:

 * Inflector::rules('transliteration', ['/å/' => 'aa']);
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::load('Migrations');
Plugin::load('Bootstrap');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
DispatcherFactory::add('LocaleSelector');
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 */
Type::build('date')->useLocaleParser();
Type::build('datetime')->useLocaleParser();
开发者ID:eduardoweiland,项目名称:jasmine,代码行数:31,代码来源:bootstrap.php

示例12:

<?php

/**
 * Licensed under The MIT License
 * For full copyright and license information, please see the LICENSE.txt
 * Redistributions of files must retain the above copyright notice.
 *
 * @copyright     Copyright (c) MindForce Team (http://mindforce.me)
 * @link          http://mindforce.me Garderobe CakePHP 3 UI Plugin
 * @since         0.0.1
 * @license       http://www.opensource.org/licenses/mit-license.php MIT License
 */
use Cake\Event\EventManager;
use Cake\Core\Configure;
use Cake\Routing\DispatcherFactory;
EventManager::instance()->attach(new Garderobe\Core\Event\CoreEvent(), null);
DispatcherFactory::add('Garderobe/Core.Asset');
开发者ID:mindforce,项目名称:cakephp-garderobe,代码行数:17,代码来源:bootstrap.php

示例13: _sendRequest

 /**
  * Creates and send the request into a Dispatcher instance.
  *
  * Receives and stores the response for future inspection.
  *
  * @param string|array $url The URL
  * @param string $method The HTTP method
  * @param array|null $data The request data.
  * @return void
  * @throws \Exception
  */
 protected function _sendRequest($url, $method, $data = [])
 {
     $request = $this->_buildRequest($url, $method, $data);
     $response = new Response();
     $dispatcher = DispatcherFactory::create();
     $dispatcher->eventManager()->on('Dispatcher.beforeDispatch', ['priority' => 999], [$this, 'controllerSpy']);
     try {
         $dispatcher->dispatch($request, $response);
         $this->_requestSession = $request->session();
         $this->_response = $response;
     } catch (PHPUnit_Exception $e) {
         throw $e;
     } catch (DatabaseException $e) {
         throw $e;
     } catch (Exception $e) {
         $this->_exception = $e;
         $this->_handleError($e);
     }
 }
开发者ID:hossain-seaos,项目名称:cakephp,代码行数:30,代码来源:IntegrationTestCase.php

示例14:

 * Inflector::rules('transliteration', ['/å/' => 'aa']);
 */
/**
 * Plugins need to be loaded manually, you can either load them one by one or all of them in a single call
 * Uncomment one of the lines below, as you need. make sure you read the documentation on Plugin to use more
 * advanced ways of loading plugins
 *
 * Plugin::loadAll(); // Loads all plugins at once
 * Plugin::load('Migrations'); //Loads a single plugin named Migrations
 *
 */
Plugin::load('Migrations');
// Only try to load DebugKit in development mode
// Debug Kit should not be installed on a production system
if (Configure::read('debug')) {
    Plugin::load('DebugKit', ['bootstrap' => true]);
}
/**
 * Connect middleware/dispatcher filters.
 */
DispatcherFactory::add('Asset');
DispatcherFactory::add('Routing');
DispatcherFactory::add('ControllerFactory');
/**
 * Enable default locale format parsing.
 * This is needed for matching the auto-localized string output of Time() class when parsing dates.
 */
Type::build('date')->useLocaleParser();
Type::build('datetime')->useLocaleParser();
Plugin::load('BoxManager', ['bootstrap' => false, 'routes' => true]);
Plugin::load('SocialManager', ['bootstrap' => false, 'routes' => true]);
开发者ID:Aerue,项目名称:avalia,代码行数:31,代码来源:bootstrap.php

示例15: _shutdown

 /**
  * Run the shutdown events.
  *
  * Triggers the afterFilter and afterDispatch events.
  *
  * @return \Cake\Network\Response The response to serve.
  */
 protected function _shutdown()
 {
     $this->controller->dispatchEvent('Controller.shutdown');
     $dispatcher = DispatcherFactory::create();
     $eventManager = $dispatcher->eventManager();
     foreach ($dispatcher->filters() as $filter) {
         $eventManager->attach($filter);
     }
     $args = ['request' => $this->controller->request, 'response' => $this->controller->response];
     $result = $dispatcher->dispatchEvent('Dispatcher.afterDispatch', $args);
     return $result->data['response'];
 }
开发者ID:aceat64,项目名称:cakephp,代码行数:19,代码来源:ExceptionRenderer.php


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