protected function extractUrlRepository($url) { if (preg_match('/https?:\\/\\/(www.)?github.com\\/(?<username>[\\w_-]+)\\/(?<repository>[\\w_-]+)/', $url, $matches)) { return $matches['username'] . '/' . $matches['repository']; } return null; }