本文整理汇总了PHP中GuzzleHttp\Url::getScheme方法的典型用法代码示例。如果您正苦于以下问题:PHP Url::getScheme方法的具体用法?PHP Url::getScheme怎么用?PHP Url::getScheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类GuzzleHttp\Url
的用法示例。
在下文中一共展示了Url::getScheme方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getSchemeAndHost
/**
* {@inheritdoc }
*/
public function getSchemeAndHost()
{
return sprintf('%s://%s', $this->baseUrl->getScheme(), $this->baseUrl->getHost());
}
示例2: parseConnections
protected function parseConnections($options, $defaultHost, $defaultPort)
{
if (isset($options['host']) || isset($options['port'])) {
$options['connections'][] = $options;
}
/** @var Url[] $toParse */
$toParse = [];
if (isset($options['connections'])) {
foreach ((array) $options['connections'] as $alias => $conn) {
if (is_string($conn)) {
$conn = ['host' => $conn];
}
$scheme = isset($conn['scheme']) ? $conn['scheme'] : 'tcp';
$host = isset($conn['host']) ? $conn['host'] : $defaultHost;
$url = new Url($scheme, $host);
$url->setPort(isset($conn['port']) ? $conn['port'] : $defaultPort);
if (isset($conn['path'])) {
$url->setPath($conn['path']);
}
if (isset($conn['password'])) {
$url->setPassword($conn['password']);
}
$url->getQuery()->replace($conn);
$toParse[] = $url;
}
} elseif (isset($options['save_path'])) {
foreach (explode(',', $options['save_path']) as $conn) {
$toParse[] = Url::fromString($conn);
}
}
$connections = [];
foreach ($toParse as $url) {
$connections[] = ['scheme' => $url->getScheme(), 'host' => $url->getHost(), 'port' => $url->getPort(), 'path' => $url->getPath(), 'alias' => $url->getQuery()->get('alias'), 'prefix' => $url->getQuery()->get('prefix'), 'password' => $url->getPassword(), 'database' => $url->getQuery()->get('database'), 'persistent' => $url->getQuery()->get('persistent'), 'weight' => $url->getQuery()->get('weight'), 'timeout' => $url->getQuery()->get('timeout')];
}
return $connections;
}
示例3: validateUrl
/**
* Ensures that the url of the certificate is one belonging to AWS, and not
* just something from the amazonaws domain, which includes S3 buckets.
*
* @param Url $url
*
* @throws MessageValidatorException if the cert url is invalid
*/
private function validateUrl(Url $url)
{
// The cert URL must be https, a .pem, and match the following pattern.
$hostPattern = '/^sns\\.[a-zA-Z0-9\\-]{3,}\\.amazonaws\\.com(\\.cn)?$/';
if ($url->getScheme() !== 'https' || substr($url, -4) !== '.pem' || !preg_match($hostPattern, $url->getHost())) {
throw new MessageValidatorException('The certificate is located ' . 'on an invalid domain.');
}
}