first work on remote forking
[phorkie.git] / src / phorkie / ForkRemote.php
diff --git a/src/phorkie/ForkRemote.php b/src/phorkie/ForkRemote.php
new file mode 100644 (file)
index 0000000..f3639b2
--- /dev/null
@@ -0,0 +1,42 @@
+<?php
+namespace phorkie;
+
+class ForkRemote
+{
+    protected $url;
+
+    public function __construct($url)
+    {
+        $this->url = $url;
+    }
+
+    public function parse()
+    {
+        $scheme = parse_url($this->url, PHP_URL_SCHEME);
+        switch ($scheme) {
+        case 'git':
+            //clearly a git url
+            $this->gitUrl = $this->url;
+            return true;
+
+        case 'ssh':
+            //FIXME: maybe loosen this when we know how to skip the 
+            //"do you trust this server" question of ssh
+            $this->error = 'ssh:// URLs are not supported';
+            return false;
+
+        case 'http':
+        case 'https':
+            return $this->extractUrlsFromHtml($this->url);
+        }
+
+        $this->error = 'Unknown URLs scheme: ' . $scheme;
+        return false;
+    }
+
+    protected function extractUrlsFromHtml($url)
+    {
+    }
+}
+
+?>