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


PHP PhutilURI::setPort方法代码示例

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


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

示例1: getSSHCloneURIObject

 /**
  * Get the repository's SSH clone/checkout URI, if one exists.
  */
 public function getSSHCloneURIObject()
 {
     if (!$this->isHosted()) {
         if ($this->shouldUseSSH()) {
             return $this->getRemoteURIObject();
         } else {
             return null;
         }
     }
     $serve_ssh = $this->getServeOverSSH();
     if ($serve_ssh === self::SERVE_OFF) {
         return null;
     }
     $uri = new PhutilURI(PhabricatorEnv::getProductionURI($this->getURI()));
     if ($this->isSVN()) {
         $uri->setProtocol('svn+ssh');
     } else {
         $uri->setProtocol('ssh');
     }
     if ($this->isGit()) {
         $uri->setPath($uri->getPath() . $this->getCloneName() . '.git');
     } else {
         if ($this->isHg()) {
             $uri->setPath($uri->getPath() . $this->getCloneName() . '/');
         }
     }
     $ssh_user = PhabricatorEnv::getEnvConfig('diffusion.ssh-user');
     if ($ssh_user) {
         $uri->setUser($ssh_user);
     }
     $ssh_host = PhabricatorEnv::getEnvConfig('diffusion.ssh-host');
     if (strlen($ssh_host)) {
         $uri->setDomain($ssh_host);
     }
     $uri->setPort(PhabricatorEnv::getEnvConfig('diffusion.ssh-port'));
     return $uri;
 }
开发者ID:patelhardik,项目名称:phabricator,代码行数:40,代码来源:PhabricatorRepository.php

示例2: getURIObject

 private function getURIObject()
 {
     // Users can provide Git/SCP-style URIs in the form "user@host:path".
     // In the general case, these are not equivalent to any "ssh://..." form
     // because the path is relative.
     if ($this->isBuiltin()) {
         $builtin_protocol = $this->getForcedProtocol();
         $builtin_domain = $this->getForcedHost();
         $raw_uri = "{$builtin_protocol}://{$builtin_domain}";
     } else {
         $raw_uri = $this->getURI();
     }
     $port = $this->getForcedPort();
     $default_ports = array('ssh' => 22, 'http' => 80, 'https' => 443);
     $uri = new PhutilURI($raw_uri);
     // Make sure to remove any password from the URI before we do anything
     // with it; this should always be provided by the associated credential.
     $uri->setPass(null);
     $protocol = $this->getForcedProtocol();
     if ($protocol) {
         $uri->setProtocol($protocol);
     }
     if ($port) {
         $uri->setPort($port);
     }
     // Remove any explicitly set default ports.
     $uri_port = $uri->getPort();
     $uri_protocol = $uri->getProtocol();
     $uri_default = idx($default_ports, $uri_protocol);
     if ($uri_default && $uri_default == $uri_port) {
         $uri->setPort(null);
     }
     $user = $this->getForcedUser();
     if ($user) {
         $uri->setUser($user);
     }
     $host = $this->getForcedHost();
     if ($host) {
         $uri->setDomain($host);
     }
     $path = $this->getForcedPath();
     if ($path) {
         $uri->setPath($path);
     }
     return $uri;
 }
开发者ID:rchicoli,项目名称:phabricator,代码行数:46,代码来源:PhabricatorRepositoryURI.php


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