WordPress\AiClientDependencies\Nyholm\Psr7
Uri::withUserInfo
Method of the class: Uri{}
No Hooks.
Returns
static.
Usage
$Uri = new Uri(); $Uri->withUserInfo( $user, $password ): UriInterface;
- $user(required)
- .
- $password
- .
Default:null
Uri::withUserInfo() Uri::withUserInfo code WP 7.0
public function withUserInfo($user, $password = null): UriInterface
{
if (!\is_string($user)) {
throw new \InvalidArgumentException('User must be a string');
}
$info = \preg_replace_callback('/[' . self::CHAR_GEN_DELIMS . self::CHAR_SUB_DELIMS . ']++/', [__CLASS__, 'rawurlencodeMatchZero'], $user);
if (null !== $password && '' !== $password) {
if (!\is_string($password)) {
throw new \InvalidArgumentException('Password must be a string');
}
$info .= ':' . \preg_replace_callback('/[' . self::CHAR_GEN_DELIMS . self::CHAR_SUB_DELIMS . ']++/', [__CLASS__, 'rawurlencodeMatchZero'], $password);
}
if ($this->userInfo === $info) {
return $this;
}
$new = clone $this;
$new->userInfo = $info;
return $new;
}