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


PHP Message\UriInterface类代码示例

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


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

示例1: __construct

 /**
  * @param UriInterface $uri        Has to contain a host name and cans have a path.
  * @param array        $hostConfig Config for AddHostPlugin. @see AddHostPlugin::configureOptions
  */
 public function __construct(UriInterface $uri, array $hostConfig = [])
 {
     $this->addHostPlugin = new AddHostPlugin($uri, $hostConfig);
     if (rtrim($uri->getPath(), '/')) {
         $this->addPathPlugin = new AddPathPlugin($uri);
     }
 }
开发者ID:php-http,项目名称:client-common,代码行数:11,代码来源:BaseUriPlugin.php

示例2: setBase

 public function setBase(UriInterface $uri)
 {
     $base = (string) $uri->withPath('')->withQuery('')->withFragment('');
     if ($base and $base !== $this->base) {
         $this->base = $base;
     }
 }
开发者ID:spiderling-php,项目名称:curl-driver,代码行数:7,代码来源:Loader.php

示例3: handle

 /**
  * @param AccessToken $accessToken
  * @param UriInterface $destination
  * @return Response
  */
 public function handle(AccessToken $accessToken, UriInterface $destination)
 {
     $claims = $this->userService->getUserClaims($accessToken)->toArray();
     $jwt = $this->encoderService->encode($claims);
     $q = $destination->getQuery();
     $q .= ($q ? '&' : '') . 'jwt=' . $jwt;
     return new RedirectResponse((string) $destination->withQuery($q));
 }
开发者ID:cultuurnet,项目名称:jwt-provider,代码行数:13,代码来源:JwtOAuthCallbackHandler.php

示例4: updateBaseUri

 public function updateBaseUri(UriInterface $uri)
 {
     $base = (string) $uri->withPath('')->withQuery('')->withFragment('');
     $oldBase = (string) $this->getClient()->getConfig('base_uri');
     if ($base and $base !== $oldBase) {
         $this->client = new Client(['base_uri' => $base]);
     }
 }
开发者ID:spiderling-php,项目名称:guzzle-driver,代码行数:8,代码来源:Loader.php

示例5: sameValueAs

 /**
  * {@inheritdoc}
  */
 public function sameValueAs(UriInterface $url)
 {
     try {
         return static::createFromComponents($this->schemeRegistry, static::Parse($url->__toString()))->toAscii()->normalize()->ksortQuery()->__toString() === $this->toAscii()->normalize()->ksortQuery()->__toString();
     } catch (InvalidArgumentException $e) {
         return false;
     }
 }
开发者ID:BauRo,项目名称:url,代码行数:11,代码来源:Properties.php

示例6: buildRouteUri

 /**
  * Builds URI for provided route instance.
  *
  * @param RouteContract $route
  * @param array $variables
  * @param array $query
  * @return UriInterface
  */
 private function buildRouteUri(RouteContract $route, array $variables = [], array $query = []) : UriInterface
 {
     $uri = $this->uri->withScheme($route->getScheme() ?: $this->request->getUri()->getScheme())->withHost($route->getHost() ?: $this->request->getUri()->getHost())->withPath($route->compilePath($variables));
     if ($query) {
         $uri = $uri->withQuery(http_build_query($query));
     }
     return $uri;
 }
开发者ID:venta,项目名称:framework,代码行数:16,代码来源:UrlGenerator.php

示例7: createRtmpUrl

 private function createRtmpUrl(UriInterface $uri)
 {
     // Use a relative URL when creating Flash player URLs
     $result = ltrim($uri->getPath(), '/');
     if ($query = $uri->getQuery()) {
         $result .= '?' . $query;
     }
     return $result;
 }
开发者ID:AWSRandall,项目名称:aws-sdk-php,代码行数:9,代码来源:UrlSigner.php

示例8: addQueryParameters

 /**
  * Merges additional query parameters with current query parameters (possibly overwriting (some of) them)
  *
  * @param UriInterface $uri
  * @param array $queryParameters Query parameters to add / overwrite
  * @return UriInterface
  */
 public static function addQueryParameters(UriInterface $uri, array $queryParameters)
 {
     $originalQuery = $uri->getQuery();
     $originalQueryParameters = [];
     parse_str($originalQuery, $originalQueryParameters);
     $newQueryParameters = array_replace_recursive($originalQueryParameters, $queryParameters);
     $newQuery = http_build_query($newQueryParameters);
     $newUri = $uri->withQuery($newQuery);
     return $newUri;
 }
开发者ID:subscribo,项目名称:psr-http-message-tools,代码行数:17,代码来源:UriFactory.php

示例9: getQueryParams

 /**
  * Gets the query parameters as an array from a ``UriInterface`` instance.
  *
  * @param UriInterface $uri
  * @param array $exclude
  * @param array $params
  *
  * @return array
  */
 public function getQueryParams(UriInterface $uri, $exclude = ['sig'], $params = [])
 {
     parse_str($uri->getQuery(), $params);
     foreach ($exclude as $excludedParam) {
         if (array_key_exists($excludedParam, $params)) {
             unset($params[$excludedParam]);
         }
     }
     return $params;
 }
开发者ID:larabros,项目名称:elogram,代码行数:19,代码来源:UrlParserTrait.php

示例10: withUri

 public function withUri(Psr7UriInterface $uri, $preserveHost = false)
 {
     $new = clone $this;
     $new->uri = $uri;
     $uriHost = $uri->getHost();
     $requestHost = $new->getHeaderLine('Host');
     if (!$preserveHost && $uriHost !== $requestHost) {
         return $new->withHeader('Host', $uriHost);
     }
     return $new;
 }
开发者ID:cerad,项目名称:http,代码行数:11,代码来源:Request.php

示例11: parseVirtualHosted

 private function parseVirtualHosted(UriInterface $url, array $matches)
 {
     $result = self::$defaultResult;
     $result['path_style'] = false;
     // Remove trailing "." from the prefix to get the bucket
     $result['bucket'] = substr($matches[1], 0, -1);
     $path = $url->getPath();
     // Check if a key was present, and if so, removing the leading "/"
     $result['key'] = !$path || $path == '/' ? null : substr($path, 1);
     return $result;
 }
开发者ID:Air-Craft,项目名称:air-craft-www,代码行数:11,代码来源:S3UriParser.php

示例12: withUri

 public function withUri(\Psr\Http\Message\UriInterface $uri, $preserveHost = false)
 {
     $request = clone $this;
     $request->uri = $uri;
     if (!$preserveHost or !$this->hasHeader('Host')) {
         $host = $uri->getHost();
         if ($host != '') {
             $request->setHeader('Host', $host);
         }
     }
     return $request;
 }
开发者ID:jivoo,项目名称:http,代码行数:12,代码来源:RequestTrait.php

示例13: withUri

 function withUri(UriInterface $uri, $preserveHost = FALSE) : self
 {
     $headers = $this->headers;
     $headers['HOST'] = $headers['HOST'] ?? [];
     if (!$preserveHost && $uri->getHost()) {
         $headers['HOST'] = [$uri->getHost()];
     }
     $new = clone $this;
     $new->headers = $headers;
     $new->headerNames['HOST'] = 'Host';
     $new->uri = parse_url((string) $uri);
     return $new;
 }
开发者ID:guide42,项目名称:ochenta,代码行数:13,代码来源:RequestTrait.php

示例14: isFiltered

 public function isFiltered(UriInterface $currentUri, UriInterface $startUri)
 {
     /* @var $currentUri Uri */
     /* @var $startUri Uri */
     $startDomainElements = explode('.', $startUri->getHost());
     $currentDomainElements = explode('.', $currentUri->getHost());
     $startDomainLength = count($startDomainElements);
     $currentDomainLength = count($currentDomainElements);
     if ($currentDomainLength < $startDomainLength) {
         return true;
     }
     return $currentUri->getHost($startDomainLength) !== $startUri->getHost($startDomainLength);
 }
开发者ID:phmlabs,项目名称:smoke,代码行数:13,代码来源:ForeignDomainFilter.php

示例15: getSelectedValues

 public function getSelectedValues(UriInterface $uri)
 {
     $queryParams = Psr7\parse_query($uri->getQuery());
     $selectedValues = [];
     foreach ($queryParams as $paramName => $params) {
         if (!isset($this->paramFacets[$paramName])) {
             continue;
         }
         $facetName = $this->paramFacets[$paramName];
         $selectedValues[$facetName] = $params;
     }
     return $selectedValues;
 }
开发者ID:sphereio,项目名称:commercetools-php-symfony,代码行数:13,代码来源:Search.php


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