X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/56bf0267e1e3218e22992a25927a10e754bf71f3..d63a7b14a6e1140fe5aa0610b1490f69b3494623:/src/phorkie/ForkRemote.php diff --git a/src/phorkie/ForkRemote.php b/src/phorkie/ForkRemote.php index 3f6a478..7f6129d 100644 --- a/src/phorkie/ForkRemote.php +++ b/src/phorkie/ForkRemote.php @@ -3,6 +3,11 @@ namespace phorkie; class ForkRemote { + /** + * Contains error message when parse() failed + */ + public $error; + protected $url; /** @@ -22,8 +27,13 @@ class ForkRemote public function parse() { + if ($this->url == '') { + $this->error = 'Empty fork URL'; + return false; + } + $arUrl = parse_url($this->url); - $scheme = $arUrl['scheme'] ?: ''; + $scheme = isset($arUrl['scheme']) ? $arUrl['scheme'] : ''; if ($scheme == 'https' && isset($arUrl['host']) && $arUrl['host'] == 'gist.github.com' @@ -85,7 +95,12 @@ class ForkRemote } } - return $count > 0; + if ($count > 0) { + return true; + } + + $this->error = 'No git:// clone URL found'; + return false; } /**