Changeset View
Changeset View
Standalone View
Standalone View
src/parser/PhutilGitURI.php
| <?php | <?php | ||||
| /** | /** | ||||
| * Parser for the alternate URI scheme used by SCP and Git, which look | * Parser for the alternate URI scheme used by SCP and Git, which look | ||||
| * like this: | * like this: | ||||
| * | * | ||||
| * user@host:path | * user@host:path | ||||
| * | * | ||||
| * (Git calls these URIs "scp-style" in its documentation, but most users and | * (Git calls these URIs "scp-style" in its documentation, but most users and | ||||
| * developers are likely to run into them in the context of Git and I couldn't | * developers are likely to run into them in the context of Git and I couldn't | ||||
| * find an official name or specification, so I'm going with "GitURI".) | * find an official name or specification, so I'm going with "GitURI".) | ||||
| * | * | ||||
| * Note that these URIs can not be transformed into normal URIs because the | * Note that these URIs can not be transformed into normal URIs because the | ||||
| * path is interpreted as relative on the remote, rather than absolute (as with | * path is interpreted as relative on the remote, rather than absolute (as with | ||||
| * normal URIs). | * normal URIs). | ||||
| */ | */ | ||||
| final class PhutilGitURI { | final class PhutilGitURI extends Phobject { | ||||
| private $user; | private $user; | ||||
| private $domain; | private $domain; | ||||
| private $path; | private $path; | ||||
| public function __construct($uri) { | public function __construct($uri) { | ||||
| $parts = $this->parseURI($uri); | $parts = $this->parseURI($uri); | ||||
| if ($parts) { | if ($parts) { | ||||
| ▲ Show 20 Lines • Show All 67 Lines • Show Last 20 Lines | |||||