當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。