當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Url::getScheme方法代碼示例

本文整理匯總了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());
 }
開發者ID:Owsy,項目名稱:sylius-api-php,代碼行數:7,代碼來源:Client.php

示例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;
 }
開發者ID:nectd,項目名稱:nectd-web,代碼行數:36,代碼來源:SessionServiceProvider.php

示例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.');
     }
 }
開發者ID:briareos,項目名稱:aws-sdk-php,代碼行數:16,代碼來源:MessageValidator.php


注:本文中的GuzzleHttp\Url::getScheme方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。