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


PHP HttpFoundation\Request类代码示例

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


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

示例1: setUp

 protected function setUp()
 {
     $this->controller = $controller = $this->getMock("Thelia\\Controller\\BaseController", ["getParser", "render", "renderRaw"]);
     /**
      * Reset static :: $formDefinition on controllers
      */
     $this->definitionReflection = $reflection = (new \ReflectionObject($this->controller))->getProperty('formDefinition');
     $reflection->setAccessible(true);
     $this->formDefinition = $reflection->getValue();
     $reflection->setValue(null);
     /**
      * Add the test type to the factory and
      * the form to the container
      */
     $factory = new FormFactoryBuilder();
     $factory->addExtension(new CoreExtension());
     $factory->addType(new TestType());
     /**
      * Construct the container
      */
     $container = new Container();
     $container->set("thelia.form_factory_builder", $factory);
     $container->set("thelia.translator", new Translator($container));
     $container->setParameter("thelia.parser.forms", array("test_form" => "Thelia\\Tests\\Resources\\Form\\TestForm"));
     $request = new Request();
     $request->setSession(new Session(new MockArraySessionStorage()));
     $container->set("request", $request);
     $container->set("thelia.forms.validator_builder", new ValidatorBuilder());
     $container->set("event_dispatcher", new EventDispatcher());
     $this->controller->setContainer($container);
 }
开发者ID:badelas,项目名称:thelia,代码行数:31,代码来源:BaseControllerTest.php

示例2: __construct

 public function __construct(Request $request)
 {
     if ($request->getSession() != null) {
         $this->locale = $request->getSession()->getLang()->getLocale();
     } else {
         $this->locale = Lang::getDefaultLanguage()->getLocale();
     }
 }
开发者ID:alex63530,项目名称:thelia,代码行数:8,代码来源:TinyMCELanguage.php

示例3: getGetResponseEvent

 protected function getGetResponseEvent()
 {
     $request = new Request();
     $request->setSession(new Session(new MockArraySessionStorage()));
     /** @var HttpKernelInterface $kernelMock */
     $kernelMock = $this->getMockBuilder('Symfony\\Component\\HttpKernel\\HttpKernelInterface')->disableOriginalConstructor()->getMock();
     return new GetResponseEvent($kernelMock, $request, HttpKernelInterface::MASTER_REQUEST);
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:8,代码来源:RequestListenerTest.php

示例4: init

 protected function init()
 {
     $container = $this->getContainer();
     $request = new Request();
     $request->setSession(new Session(new MockArraySessionStorage()));
     /** @var RequestStack $requestStack */
     $requestStack = $container->get('request_stack');
     $requestStack->push($request);
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:9,代码来源:AdminUpdatePasswordCommand.php

示例5: setUp

 public function setUp()
 {
     $session = new Session(new MockArraySessionStorage());
     $request = new Request();
     $request->setSession($session);
     $this->mailerFactory = $this->getMockBuilder("Thelia\\Mailer\\MailerFactory")->disableOriginalConstructor()->getMock();
     $translator = new Translator(new Container());
     $this->tokenProvider = new TokenProvider($request, $translator, 'test');
 }
开发者ID:GuiminZHOU,项目名称:thelia,代码行数:9,代码来源:AdministratorTest.php

示例6: getContainer

 public function getContainer()
 {
     $container = new ContainerBuilder();
     $container->set("event_dispatcher", $this->getDispatcher());
     $request = new Request();
     $request->setSession($this->session);
     $container->set("request", $request);
     return $container;
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:9,代码来源:ImageTest.php

示例7: getContainer

 public function getContainer()
 {
     $container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
     $container->set("event_dispatcher", $this->getDispatcher());
     $request = new Request();
     $request->setSession($this->session);
     $container->set("request", $request);
     return $container;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:9,代码来源:ImageTest.php

示例8: setUp

 public function setUp()
 {
     parent::setUp();
     $session = new Session(new MockArraySessionStorage());
     $request = new Request();
     $request->setSession($session);
     $this->requestStack = new RequestStack();
     $this->requestStack->push($request);
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:9,代码来源:LangTest.php

示例9: append

 /**
  * A simple helper to insert an entry in the admin log
  *
  * @param $resource
  * @param $action
  * @param $message
  * @param Request       $request
  * @param UserInterface $adminUser
  * @param bool          $withRequestContent
  */
 public static function append($resource, $action, $message, Request $request, UserInterface $adminUser = null, $withRequestContent = true)
 {
     $log = new AdminLog();
     $log->setAdminLogin($adminUser !== null ? $adminUser->getUsername() : '<no login>')->setAdminFirstname($adminUser !== null && $adminUser instanceof Admin ? $adminUser->getFirstname() : '<no first name>')->setAdminLastname($adminUser !== null && $adminUser instanceof Admin ? $adminUser->getLastname() : '<no last name>')->setResource($resource)->setAction($action)->setMessage($message)->setRequest($request->toString($withRequestContent));
     try {
         $log->save();
     } catch (\Exception $ex) {
         Tlog::getInstance()->err("Failed to insert new entry in AdminLog: {ex}", array('ex' => $ex));
     }
 }
开发者ID:badelas,项目名称:thelia,代码行数:20,代码来源:AdminLog.php

示例10: getContainer

 public function getContainer()
 {
     $container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
     $dispatcher = $this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface");
     $container->set("event_dispatcher", $dispatcher);
     $fileManager = new FileManager(["document.product" => "Thelia\\Model\\ProductDocument", "image.product" => "Thelia\\Model\\ProductImage", "document.category" => "Thelia\\Model\\CategoryDocument", "image.category" => "Thelia\\Model\\CategoryImage", "document.content" => "Thelia\\Model\\ContentDocument", "image.content" => "Thelia\\Model\\ContentImage", "document.folder" => "Thelia\\Model\\FolderDocument", "image.folder" => "Thelia\\Model\\FolderImage", "document.brand" => "Thelia\\Model\\BrandDocument", "image.brand" => "Thelia\\Model\\BrandImage"]);
     $container->set("thelia.file_manager", $this->getFileManager());
     $request = new Request();
     $request->setSession($this->session);
     $container->set("request", $request);
     return $container;
 }
开发者ID:margery,项目名称:thelia,代码行数:12,代码来源:DocumentTest.php

示例11: getContainer

 public function getContainer()
 {
     $container = new \Symfony\Component\DependencyInjection\ContainerBuilder();
     $container->set("thelia.translator", new Translator(new Container()));
     $dispatcher = $this->getMock("Symfony\\Component\\EventDispatcher\\EventDispatcherInterface");
     $container->set("event_dispatcher", $dispatcher);
     $request = new Request();
     $request->setSession($this->getSession());
     $container->set("request", $request);
     $container->set("thelia.securitycontext", new SecurityContext($request));
     $this->buildContainer($container);
     return $container;
 }
开发者ID:alex63530,项目名称:thelia,代码行数:13,代码来源:ContainerAwareTestCase.php

示例12: notifyAction

 /**
  * @param Request $request
  * @param $orderId
  * @return Response
  * @throws \Exception
  */
 public function notifyAction(Request $request, $orderId)
 {
     $token = $request->get('token');
     /** @var PaylineManager $payline */
     $payline = $this->getContainer()->get('payline.manager');
     if ($payline->getWebPaymentDetails($token)) {
         $this->confirmPayment($orderId);
         $this->cleanExpiredLog();
         return new Response();
     }
     $this->cancelPayment($orderId);
     $this->cleanExpiredLog();
     return new Response();
 }
开发者ID:Alban-io,项目名称:Payline,代码行数:20,代码来源:PaymentController.php

示例13: handle

 public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
 {
     if (!$request instanceof \Thelia\Core\HttpFoundation\Request) {
         $request = TheliaRequest::create($request->getUri(), $request->getMethod(), $request->getMethod() == 'GET' ? $request->query->all() : $request->request->all(), $request->cookies->all(), $request->files->all(), $request->server->all(), $request->getContent());
     }
     return parent::handle($request, $type, $catch);
 }
开发者ID:margery,项目名称:thelia,代码行数:7,代码来源:HttpCache.php

示例14: createSubRequest

 /**
  * @param string $uri
  * @param Request $request
  * @return Request
  */
 protected function createSubRequest($uri, Request $request)
 {
     $cookies = $request->cookies->all();
     $server = $request->server->all();
     // Override the arguments to emulate a sub-request.
     // Sub-request object will point to localhost as client ip and real client ip
     // will be included into trusted header for client ip
     try {
         if ($trustedHeaderName = Request::getTrustedHeaderName(Request::HEADER_CLIENT_IP)) {
             $currentXForwardedFor = $request->headers->get($trustedHeaderName, '');
             $server['HTTP_' . $trustedHeaderName] = ($currentXForwardedFor ? $currentXForwardedFor . ', ' : '') . $request->getClientIp();
         }
     } catch (\InvalidArgumentException $e) {
         // Do nothing
     }
     $server['REMOTE_ADDR'] = '127.0.0.1';
     $subRequest = TheliaRequest::create($uri, 'get', array(), $cookies, array(), $server);
     if ($request->headers->has('Surrogate-Capability')) {
         $subRequest->headers->set('Surrogate-Capability', $request->headers->get('Surrogate-Capability'));
     }
     if ($session = $request->getSession()) {
         $subRequest->setSession($session);
     }
     return $subRequest;
 }
开发者ID:vigourouxjulien,项目名称:thelia,代码行数:30,代码来源:InlineFragmentRenderer.php

示例15: checkApiAccess

 private function checkApiAccess(Request $request)
 {
     $key = $request->headers->get('authorization');
     if (null !== $key) {
         $key = substr($key, 6);
     }
     $apiAccount = ApiQuery::create()->findOneByApiKey($key);
     if (null === $apiAccount) {
         throw new UnauthorizedHttpException('Token');
     }
     $secureKey = pack('H*', $apiAccount->getSecureKey());
     $sign = hash_hmac('sha1', $request->getContent(), $secureKey);
     if ($sign != $request->query->get('sign')) {
         throw new PreconditionFailedHttpException('wrong body request signature');
     }
     return $apiAccount;
 }
开发者ID:NandoKstroNet,项目名称:thelia,代码行数:17,代码来源:ControllerListener.php


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