Skip to content

Commit

Permalink
fix casing for"GitHub "
Browse files Browse the repository at this point in the history
  • Loading branch information
patinthehat committed Nov 20, 2023
1 parent 6750164 commit f4a5797
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions configure.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ function replaceForAllOtherOSes(): array
return explode(PHP_EOL, run('grep -E -r -l -i ":author|:vendor|:package|VendorName|skeleton|migration_table_name|vendor_name|vendor_slug|[email protected]" --exclude-dir=vendor ./* ./.github/* | grep -v '.basename(__FILE__)));
}

function getGithubApiEndpoint(string $endpoint): ?stdClass
function getGitHubApiEndpoint(string $endpoint): ?stdClass
{
try {
$curl = curl_init("https://api.github.com/{$endpoint}");
Expand Down Expand Up @@ -169,7 +169,7 @@ function getGithubApiEndpoint(string $endpoint): ?stdClass
return null;
}

function searchCommitsForGithubUsername(): string
function searchCommitsForGitHubUsername(): string
{
$authorName = strtolower(trim(shell_exec('git config user.name')));

Expand All @@ -195,7 +195,7 @@ function searchCommitsForGithubUsername(): string
return explode('@', $firstCommitter['email'])[0] ?? '';
}

function guessGithubUsernameUsingCli()
function guessGitHubUsernameUsingCli()
{
try {
if (preg_match('/ogged in to github\.com as ([a-zA-Z-_]+).+/', shell_exec('gh auth status -h github.com 2>&1'), $matches)) {
Expand All @@ -208,14 +208,14 @@ function guessGithubUsernameUsingCli()
return '';
}

function guessGithubUsername(): string
function guessGitHubUsername(): string
{
$username = searchCommitsForGithubUsername();
$username = searchCommitsForGitHubUsername();
if (! empty($username)) {
return $username;
}

$username = guessGithubUsernameUsingCli();
$username = guessGitHubUsernameUsingCli();
if (! empty($username)) {
return $username;
}
Expand All @@ -227,12 +227,12 @@ function guessGithubUsername(): string
return $remoteUrlParts[1] ?? '';
}

function guessGithubVendorInfo($authorName, $username): array
function guessGitHubVendorInfo($authorName, $username): array
{
$remoteUrl = shell_exec('git config remote.origin.url');
$remoteUrlParts = explode('/', str_replace(':', '/', trim($remoteUrl)));

$response = getGithubApiEndpoint("orgs/{$remoteUrlParts[1]}");
$response = getGitHubApiEndpoint("orgs/{$remoteUrlParts[1]}");

if ($response === null) {
return $username;
Expand All @@ -246,12 +246,12 @@ function guessGithubVendorInfo($authorName, $username): array

$gitEmail = run('git config user.email');
$authorEmail = ask('Author email', $gitEmail);
$authorUsername = ask('Author username', guessGithubUsername());
$authorUsername = ask('Author username', guessGitHubUsername());

$guessGithubVendorInfo = guessGithubVendorInfo($authorName, $authorUsername);
$guessGitHubVendorInfo = guessGitHubVendorInfo($authorName, $authorUsername);

$vendorName = ask('Vendor name', $guessGithubVendorInfo[0]);
$vendorUsername = ask('Vendor username', $guessGithubVendorInfo[1] ?? slugify($vendorName));
$vendorName = ask('Vendor name', $guessGitHubVendorInfo[0]);
$vendorUsername = ask('Vendor username', $guessGitHubVendorInfo[1] ?? slugify($vendorName));
$vendorSlug = slugify($vendorUsername);

$vendorNamespace = str_replace('-', '', ucwords($vendorName));
Expand Down

0 comments on commit f4a5797

Please sign in to comment.