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


PHP Request::setInstance方法代码示例

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


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

示例1: initRequest

 /**
  * get CLI Request
  *
  * @return Cli\Request
  */
 public function initRequest()
 {
     $request = new Cli\Request();
     if ($config = Config::getData('request')) {
         $request->setOptions($config);
     }
     Request::setInstance($request);
 }
开发者ID:dezvell,项目名称:skeleton,代码行数:13,代码来源:CliBootstrap.php

示例2: testProcessRequest

 /**
  * Process Request
  */
 public function testProcessRequest()
 {
     $request = Request::getInstance();
     $request = $request->withQueryParams(['arr-page' => 2, 'arr-limit' => 2, 'arr-order-id' => 'desc', 'arr-filter-name' => 'ne-Smith', 'arr-filter-status' => 'disable']);
     Request::setInstance($request);
     $grid = new ArrayGrid();
     $this->assertEquals(8, $grid->total());
     $this->assertEquals(4, $grid->pages());
 }
开发者ID:bluzphp,项目名称:framework,代码行数:12,代码来源:GridTest.php

示例3: initRequest

 /**
  * get CLI Request
  * @return void
  * @throws ApplicationException
  */
 public function initRequest()
 {
     $arguments = getopt("u:", ["uri:"]);
     if (!array_key_exists('u', $arguments) && !array_key_exists('uri', $arguments)) {
         throw new ApplicationException('Attribute `--uri` is required');
     }
     $uri = $arguments['u'] ?? $arguments['uri'];
     $request = RequestFactory::fromGlobals(['REQUEST_URI' => $uri, 'REQUEST_METHOD' => 'CLI']);
     Request::setInstance($request);
 }
开发者ID:bluzphp,项目名称:skeleton,代码行数:15,代码来源:CliBootstrap.php

示例4: testErrorController

 /**
  * Test run Error Controller
  */
 public function testErrorController()
 {
     // setup Request
     $request = new ServerRequest([], [], uniqid('module') . '/' . uniqid('controller'), Request::METHOD_GET);
     Request::setInstance($request);
     // run Application
     $this->getApp()->process();
     $this->assertEquals(Router::getErrorModule(), $this->getApp()->getModule());
     $this->assertEquals(Router::getErrorController(), $this->getApp()->getController());
 }
开发者ID:bluzphp,项目名称:framework,代码行数:13,代码来源:ApplicationTest.php

示例5: resetApp

 /**
  * Reset layout and Request
  */
 protected static function resetApp()
 {
     if (self::$app) {
         self::$app->useLayout(true);
     }
     Proxy\Auth::clearIdentity();
     Proxy\Messages::popAll();
     Proxy\Request::setInstance(new Http\Request());
     Proxy\Response::setInstance(new Http\Response());
     Proxy\Response::setPresentation(null);
 }
开发者ID:9618211,项目名称:framework,代码行数:14,代码来源:TestCase.php

示例6: initRequest

 /**
  * Initial Request instance
  * @return void
  */
 protected function initRequest()
 {
     $request = new Http\Request();
     $request->setOptions(Config::getData('request'));
     Request::setInstance($request);
 }
开发者ID:Kit-kat1,项目名称:custom-bluz-app,代码行数:10,代码来源:Application.php

示例7: resetApp

 /**
  * Reset layout and Request
  */
 protected static function resetApp()
 {
     if (self::$app) {
         self::$app->useLayout(true);
         self::$app->resetRouter();
     }
     Proxy\Auth::clearIdentity();
     Proxy\Messages::popAll();
     Proxy\Request::setInstance(RequestFactory::fromGlobals());
     Proxy\Response::setInstance(new Bluz\Response\Response());
 }
开发者ID:bluzphp,项目名称:framework,代码行数:14,代码来源:TestCase.php

示例8: initRequest

 /**
  * Initial Request instance
  *
  * @return void
  */
 protected function initRequest()
 {
     $request = RequestFactory::fromGlobals();
     Request::setInstance($request);
 }
开发者ID:bluzphp,项目名称:framework,代码行数:10,代码来源:Application.php

示例9: resetRequest

 /**
  * Reset Request
  *
  * @return void
  */
 protected function resetRequest()
 {
     $request = Request::getInstance();
     // priority:
     //  - default values
     //  - from GET query
     //  - from path
     $request = $request->withQueryParams(array_merge(['_module' => $this->getDefaultModule(), '_controller' => $this->getDefaultController()], $request->getQueryParams(), $this->params));
     Request::setInstance($request);
 }
开发者ID:bluzphp,项目名称:framework,代码行数:15,代码来源:Router.php


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