本文整理汇总了PHP中Psr\Http\Message\ServerRequestInterface::withQueryParams方法的典型用法代码示例。如果您正苦于以下问题:PHP ServerRequestInterface::withQueryParams方法的具体用法?PHP ServerRequestInterface::withQueryParams怎么用?PHP ServerRequestInterface::withQueryParams使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Http\Message\ServerRequestInterface
的用法示例。
在下文中一共展示了ServerRequestInterface::withQueryParams方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: changingListenerVariableWillBeRespectedWhenDeterminingActionToken
/**
* @test
*/
public function changingListenerVariableWillBeRespectedWhenDeterminingActionToken()
{
$this->request = $this->request->withQueryParams(['mylistener' => 'sample.action']);
$this->router->setListener('mylistener');
$this->request = $this->router->resolveActionToken($this->request);
$this->assertSame('sample.action', $this->request->getAttribute(Router::ACTIONTOKEN_ATTR));
}
示例2: withQueryParams
/**
* @inheritDoc
*/
public function withQueryParams(array $query)
{
$self = clone $this;
$self->serverRequest = $this->serverRequest->withQueryParams($query);
$self->initializeParsedQueryParams();
return $self;
}
示例3: routeParamsOverwriteQueryParams
/**
* @test
*/
public function routeParamsOverwriteQueryParams()
{
$this->request = new ServerRequest([], [], '/user/123', 'GET');
$this->request = $this->request->withQueryParams(['userId' => '999']);
$this->request = $this->router->match($this->request);
$targetRequestAttribute = $this->router->getTargetRequestAttribute();
$queryParams = $this->request->getQueryParams();
$this->assertTrue(isset($queryParams['userId']));
$this->assertSame('123', $queryParams['userId']);
}
示例4: withQueryParams
/**
* {@inheritdoc}
*/
public function withQueryParams(array $query)
{
return new static($this->wrapped->withQueryParams($query));
}
示例5: parse
/**
* @inheritDoc
*/
public function parse(ServerRequestInterface $request) : ServerRequestInterface
{
parse_str($request->getUri()->getQuery(), $queryParams);
return $request->withQueryParams($queryParams);
}
示例6: withQueryParams
/**
* {@inheritDoc}
*/
public function withQueryParams(array $query)
{
return new self($this->app, $this->psrRequest->withQueryParams($query));
}
示例7: withQueryParams
/**
* Proxy to ServerRequestInterface::withQueryParams()
*
* {@inheritdoc}
*/
public function withQueryParams(array $query)
{
$new = $this->psrRequest->withQueryParams($query);
return new self($new, $this->originalRequest);
}
示例8: applyRoutingResult
/**
* Offers possibility to manipulate the request according to routing result.
* Returns a new {@link \Psr\Http\Message\ServerRequestInterface}.
*
* @param ServerRequestInterface $request
* @param RoutingResult $routingResult
* @return ServerRequestInterface
*/
protected function applyRoutingResult(ServerRequestInterface $request, RoutingResult $routingResult) : ServerRequestInterface
{
$routingParams = $routingResult->getParams();
$params = array_merge($request->getQueryParams(), $routingParams);
return $request->withQueryParams($params);
}