public function parse($dsl)
{
$ast = array('repository' => 'pecl', 'owner' => null, 'package' => $dsl);
$url = $this->toUrl($dsl);
// parse provider, owner and repository
if (preg_match("#https?://(?:www\\.)?([0-9a-zA-Z-_]*).+/([0-9a-zA-Z-._]*)/([0-9a-zA-Z-._]*)#", $url, $matches)) {
$ast['repository'] = $matches[1];
$ast['owner'] = $matches[2];
$ast['package'] = $matches[3];
}
return $ast;
}
public function exists($dsl, $packageName = NULL) { $dslparser = new RepositoryDslParser(); $info = $dslparser->parse($dsl); $this->setOwner($info['owner']); $this->setRepository($info['package']); $this->setPackageName($packageName ?: $info['package']); return $info['repository'] == 'github'; }