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


PHP UriInterface::withUserInfo方法代码示例

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


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

示例1: absoluteURIFor

 /**
  * Get the absolute URL for a given route name.
  * You must provide the current request Uri to retrieve the scheme and host.
  *
  * @param UriInterface $uri
  * @param string $route
  * @param array $params
  * @param array $query
  *
  * @return string
  */
 public function absoluteURIFor(UriInterface $uri, $route, array $params = [], array $query = [])
 {
     $path = $this->uriFor($route, $params);
     return (string) $uri->withUserInfo('')->withPath($path)->withQuery(http_build_query($query))->withFragment('');
 }
开发者ID:quickenloans-mcp,项目名称:mcp-panthor,代码行数:16,代码来源:URI.php

示例2: obfuscateUri

 /**
  * Obfuscates URI if there is an username and a password present
  *
  * @param UriInterface $uri
  *
  * @return UriInterface
  */
 private static function obfuscateUri($uri)
 {
     $userInfo = $uri->getUserInfo();
     if (false !== ($pos = strpos($userInfo, ':'))) {
         return $uri->withUserInfo(substr($userInfo, 0, $pos), '***');
     }
     return $uri;
 }
开发者ID:dukt,项目名称:craft-oauth,代码行数:15,代码来源:RequestException.php

示例3: buildRequest

 private function buildRequest(Command $command, UriInterface $uri) : RequestInterface
 {
     $parameters = sprintf('-db=%s&%s', urlencode($this->database), $command);
     $body = new Stream('php://temp', 'wb+');
     $body->write($parameters);
     $body->rewind();
     $request = (new Request($uri->withUserInfo(''), 'POST'))->withAddedHeader('User-agent', 'SimpleFM')->withAddedHeader('Content-type', 'application/x-www-form-urlencoded')->withAddedHeader('Content-length', (string) strlen($parameters))->withBody($body);
     $credentials = urldecode($uri->getUserInfo());
     if ($command->hasIdentity()) {
         Assertion::notNull($this->identityHandler, 'An identity handler must be set to use identities on commands');
         $identity = $command->getIdentity();
         $credentials = sprintf('%s:%s', $identity->getUsername(), $this->identityHandler->decryptPassword($identity));
     }
     $this->logger->info(sprintf('%s?%s', (string) $uri->withUserInfo(''), $parameters));
     if ('' === $credentials) {
         return $request;
     }
     return $request->withAddedHeader('Authorization', sprintf('Basic %s', base64_encode($credentials)));
 }
开发者ID:soliantconsulting,项目名称:simplefm,代码行数:19,代码来源:Connection.php


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