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


PHP ParameterBag::all方法代码示例

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


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

示例1: overrideGlobals

    /**
     * Overrides the PHP global variables according to this request instance.
     *
     * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE.
     * $_FILES is never override, see rfc1867
     *
     * @api
     */
    public function overrideGlobals()
    {
        $_GET = $this->query->all();
        $_POST = $this->request->all();
        $_SERVER = $this->server->all();
        $_COOKIE = $this->cookies->all();

        foreach ($this->headers->all() as $key => $value) {
            $key = strtoupper(str_replace('-', '_', $key));
            if (in_array($key, array('CONTENT_TYPE', 'CONTENT_LENGTH'))) {
                $_SERVER[$key] = implode(', ', $value);
            } else {
                $_SERVER['HTTP_'.$key] = implode(', ', $value);
            }
        }

        $request = array('g' => $_GET, 'p' => $_POST, 'c' => $_COOKIE);

        $requestOrder = ini_get('request_order') ?: ini_get('variable_order');
        $requestOrder = preg_replace('#[^cgp]#', '', strtolower($requestOrder)) ?: 'gp';

        $_REQUEST = array();
        foreach (str_split($requestOrder) as $order) {
            $_REQUEST = array_merge($_REQUEST, $request[$order]);
        }
    }
开发者ID:n3b,项目名称:symfony,代码行数:34,代码来源:Request.php

示例2: testReplace

 public function testReplace()
 {
     $bag = new ParameterBag(array('foo' => 'bar'));
     $bag->replace(array('FOO' => 'BAR'));
     $this->assertEquals(array('FOO' => 'BAR'), $bag->all(), '->replace() replaces the input with the argument');
     $this->assertFalse($bag->has('foo'), '->replace() overrides previously set the input');
 }
开发者ID:qasem2rubik,项目名称:laravel,代码行数:7,代码来源:ParameterBagTest.php

示例3: getValues

 /**
  * Get Values by the Query String with the option of
  * Remove some of them
  *
  * @param array $valuesToRemove
  * @return array Values to Get
  */
 private function getValues(array $valuesToRemove = array())
 {
     $values = array();
     foreach (array_diff_key($this->query->all(), $valuesToRemove) as $property => $value) {
         $values[$this->resource->getProperties()->get($property)->getInternalName()] = $value;
     }
     return $values;
 }
开发者ID:uiot,项目名称:middleware_mc_srvcl_rest_raise,代码行数:15,代码来源:InstructionFactory.php

示例4: updatesAfterUnset

 /**
  * Update every helpers and every registered renderer adapters with the right AbstractRenderer;
  * this method is called everytime we unset a renderer
  */
 protected function updatesAfterUnset()
 {
     $this->updateHelpers();
     foreach ($this->rendererAdapters->all() as $ra) {
         $ra->onRestorePreviousRenderer($this);
     }
     return $this;
 }
开发者ID:gobjila,项目名称:BackBee,代码行数:12,代码来源:Renderer.php

示例5: it_throws_an_exception_for_an_invalid_request

 public function it_throws_an_exception_for_an_invalid_request(Request $request, ParameterBag $post, ParameterBag $get)
 {
     $request->request = $post;
     $request->query = $get;
     $post->all()->willReturn([]);
     $get->all()->willReturn(['text' => 'Hello!']);
     $this->shouldThrow()->during('convert', [$request]);
 }
开发者ID:mcrumm,项目名称:phlack,代码行数:8,代码来源:RequestConverterSpec.php

示例6: transform

 public function transform(ParameterBag $item)
 {
     foreach ($item->all() as $key => $value) {
         // if value is an array with a hash, that's a serialized node's text value
         if (is_array($value) && array_key_exists('#', $value)) {
             $item->set($key, $value['#']);
         }
     }
 }
开发者ID:mvanduijker,项目名称:FMIoBundle,代码行数:9,代码来源:NodeTextTransformer.php

示例7: getResponseCookie

 /**
  * Get the response header.
  *
  * @param string $key
  *
  * @return mixed
  */
 public function getResponseCookie($key = null, $default = null)
 {
     if (!isset($this->cookie)) {
         $this->cookie = new ParameterBag();
     }
     if (is_null($key)) {
         return $this->cookie->all();
     }
     return $this->cookie->get($key, $default);
 }
开发者ID:speedwork,项目名称:core,代码行数:17,代码来源:Request.php

示例8: initializeHeaders

 protected function initializeHeaders()
 {
     $headers = array();
     foreach ($this->server->all() as $key => $value) {
         if ('http_' === strtolower(substr($key, 0, 5))) {
             $headers[substr($key, 5)] = $value;
         }
     }
     return $headers;
 }
开发者ID:roydonstharayil,项目名称:sugarbox,代码行数:10,代码来源:Request.php

示例9: _pageUrl

 /**
  * @param string                                         $url
  * @param \Symfony\Component\HttpFoundation\ParameterBag $params
  *
  * @return string
  */
 private function _pageUrl($url, ParameterBag $params)
 {
     if (!$url) {
         return '';
     }
     $allParams = $params->all();
     unset($allParams['page']);
     $strParams = http_build_query($allParams);
     return $url . '&' . $strParams;
 }
开发者ID:vampirekiss,项目名称:lumen-restful-starter-kit,代码行数:16,代码来源:ModelRepository.php

示例10: it_handles_authorization_refusal

 public function it_handles_authorization_refusal(AuthorizeControllerInterface $oauth2AuthorizeController, ParameterBag $requestBag, Application $app, Request $request, TokenStorageInterface $tokenStorage)
 {
     $app->offsetGet('security.token_storage')->willReturn($tokenStorage);
     $requestBag->all()->willReturn(['authorize' => '0']);
     $responseArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Response');
     $requestArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Request');
     $oauth2AuthorizeController->handleAuthorizeRequest($requestArgument, $responseArgument, false, null)->shouldBeCalled();
     $response = $this->__invoke($app, $request);
     $response->shouldHaveType('OAuth2\\HttpFoundationBridge\\Response');
     $response->getStatusCode()->shouldReturn(200);
 }
开发者ID:mathroc,项目名称:oauth2-provider,代码行数:11,代码来源:AuthorizeHandlerSpec.php

示例11: verifySignature

 protected function verifySignature()
 {
     $signer = new Signer($this->params->all());
     $signer->setSort($this->sort);
     $signer->setEncodePolicy($this->encodePolicy);
     $content = $signer->getContentToSign();
     $sign = $this->params->get('sign');
     $match = (new Signer())->verifyWithRSA($content, $sign, $this->getAlipayPublicKey());
     if (!$match) {
         throw new InvalidRequestException('The signature is not match');
     }
 }
开发者ID:lokielse,项目名称:omnipay-alipay,代码行数:12,代码来源:AopNotifyRequest.php

示例12: it_renders_authenticated_authorize_view

 public function it_renders_authenticated_authorize_view(UrlGeneratorInterface $urlGenerator, AuthorizeControllerInterface $oauth2AuthorizeController, AuthorizeRenderer $authorizeRenderer, Application $app, Request $request, ParameterBag $queryBag, BridgeResponse $response, TokenStorageInterface $tokenStorage, TokenInterface $token)
 {
     $responseArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Response');
     $requestArgument = Argument::type('OAuth2\\HttpFoundationBridge\\Request');
     $oauth2AuthorizeController->validateAuthorizeRequest($requestArgument, $responseArgument)->willReturn(true);
     $urlGenerator->generate('oauth2_authorize_handler', Argument::any())->willReturn('/url');
     $queryBag->all()->willReturn(['client_id' => 'clientId', 'response_type' => 'responseType']);
     $app->offsetGet('security.token_storage')->willReturn($tokenStorage);
     $tokenStorage->getToken()->willReturn($token);
     $token->getUser()->willReturn('user');
     $authorizeRenderer->render('/url', 'clientId', 'responseType', 'user')->willReturn($response);
     $this->__invoke($app, $request)->shouldReturn($response);
 }
开发者ID:mathroc,项目名称:oauth2-provider,代码行数:13,代码来源:AuthorizeValidatorSpec.php

示例13: overrideGlobals

 /**
  * Overrides the PHP global variables according to this request instance.
  *
  * It overrides $_GET, $_POST, $_REQUEST, $_SERVER, $_COOKIE, and $_FILES.
  */
 public function overrideGlobals()
 {
     $_GET = $this->query->all();
     $_POST = $this->request->all();
     $_SERVER = $this->server->all();
     $_COOKIE = $this->cookies->all();
     // FIXME: populate $_FILES
     foreach ($this->headers->all() as $key => $value) {
         $_SERVER['HTTP_' . strtoupper(str_replace('-', '_', $key))] = implode(', ', $value);
     }
     // FIXME: should read variables_order and request_order
     // to know which globals to merge and in which order
     $_REQUEST = array_merge($_GET, $_POST);
 }
开发者ID:rfc1483,项目名称:symfony,代码行数:19,代码来源:Request.php

示例14:

 function it_returns_grid_data_for_non_html_requests(RequestConfiguration $requestConfiguration, RepositoryInterface $repository, Grid $gridDefinition, GridProviderInterface $gridProvider, ResourceGridViewFactoryInterface $gridViewFactory, ResourceGridView $gridView, Pagerfanta $paginator, MetadataInterface $metadata, Request $request, ParameterBag $queryParameters)
 {
     $requestConfiguration->hasGrid()->willReturn(true);
     $requestConfiguration->getGrid()->willReturn('sylius_admin_tax_category');
     $requestConfiguration->getMetadata()->willReturn($metadata);
     $requestConfiguration->isHtmlRequest()->willReturn(false);
     $requestConfiguration->getRequest()->willReturn($request);
     $request->query = $queryParameters;
     $queryParameters->all()->willReturn(['foo' => 'bar']);
     $gridProvider->get('sylius_admin_tax_category')->willReturn($gridDefinition);
     $gridViewFactory->create($gridDefinition, Argument::type(Parameters::class), $metadata, $requestConfiguration)->willReturn($gridView);
     $gridView->getData()->willReturn($paginator);
     $this->getResources($requestConfiguration, $repository)->shouldReturn($paginator);
 }
开发者ID:ahmadrabie,项目名称:Sylius,代码行数:14,代码来源:ResourcesResolverSpec.php

示例15: transform

 /**
  * @inheritdoc
  */
 public function transform(ParameterBag $item)
 {
     if (!$this->field) {
         // expand root-level attributes
         $item->replace($this->expand($item->all()));
         return;
     }
     // proceed only when the field exists and is an array
     $value = $item->get($this->field);
     if (!is_array($value)) {
         return;
     }
     $item->set($this->field, $this->expand($value));
 }
开发者ID:treehouselabs,项目名称:feeder,代码行数:17,代码来源:ExpandAttributesTransformer.php


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