/** * @param string * @return string */ public static function normalizeUrl($url) { $data = Github\Repository::getVendorAndName($url); if (is_null($data)) { return NULL; } return 'https://github.com/' . $data[0] . '/' . $data[1]; }
/** * Returns composer.json or NULL if composer.json does not exist or is invalid. * * @param string commit hash, brach or tag name * @return stdClass|NULL * @throws \NetteAddons\IOException */ private function getComposerJson($hash) { try { $content = $this->repository->getFileContent($hash, Utils\Composer::FILENAME); $composer = Json::decode($content); if (!Utils\Composer::isValid($composer)) { return NULL; // invalid composer.json } return $composer; } catch (\NetteAddons\Utils\HttpException $e) { if ($e->getCode() === 404) { return NULL; } throw $e; } catch (\Nette\Utils\JsonException $e) { return NULL; } }