move forking code to separate class
[phorkie.git] / src / phorkie / ForkRemote.php
1 <?php
2 namespace phorkie;
3
4 class ForkRemote
5 {
6     protected $url;
7
8     public function __construct($url)
9     {
10         $this->url = $url;
11     }
12
13     public function parse()
14     {
15         $scheme = parse_url($this->url, PHP_URL_SCHEME);
16         switch ($scheme) {
17         case 'git':
18             //clearly a git url
19             $this->gitUrl = $this->url;
20             return true;
21
22         case 'ssh':
23             //FIXME: maybe loosen this when we know how to skip the 
24             //"do you trust this server" question of ssh
25             $this->error = 'ssh:// URLs are not supported';
26             return false;
27
28         case 'http':
29         case 'https':
30             return $this->extractUrlsFromHtml($this->url);
31         }
32
33         $this->error = 'Unknown URLs scheme: ' . $scheme;
34         return false;
35     }
36
37     protected function extractUrlsFromHtml($url)
38     {
39     }
40 }
41
42 ?>