Skip to content

Commit 8caa25f

Browse files
Merge branch 'main' of https://github.com/mooxphp/moox
2 parents 32819ef + 9aa0ed6 commit 8caa25f

1 file changed

Lines changed: 9 additions & 6 deletions

File tree

packages/github/src/Commands/GitHubTokenCommand.php

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@ class GitHubTokenCommand extends Command
1717
public function handle(): int
1818
{
1919
// If env token exists, we don't need a user
20-
if (!env('GITHUB_TOKEN')) {
20+
if (! env('GITHUB_TOKEN')) {
2121
$user = User::first();
2222

2323
if (! $user) {
2424
$this->error('No GitHub token in environment and no user found in database. Please add a token to .env or create a user first.');
25+
2526
return 1;
2627
}
2728
} else {
@@ -123,11 +124,13 @@ private function clearToken(?User $user): int
123124
{
124125
if (env('GITHUB_TOKEN')) {
125126
$this->error('Cannot clear environment token. Remove GITHUB_TOKEN from .env file manually.');
127+
126128
return 1;
127129
}
128130

129-
if (!$user) {
131+
if (! $user) {
130132
$this->error('No user found to clear token from.');
133+
131134
return 1;
132135
}
133136

@@ -161,15 +164,15 @@ private function showTokenInfo(?User $user): int
161164

162165
$this->info('GitHub Token Information:');
163166
$this->line("Source: {$source}");
164-
167+
165168
if ($user) {
166169
$this->line("User ID: {$user->id}");
167170
$this->line("GitHub ID: {$user->github_id}");
168171
} else {
169-
$this->line("User ID: N/A (using environment token)");
170-
$this->line("GitHub ID: N/A (using environment token)");
172+
$this->line('User ID: N/A (using environment token)');
173+
$this->line('GitHub ID: N/A (using environment token)');
171174
}
172-
175+
173176
$this->line('Token: '.substr($token, 0, 10).'...'.substr($token, -4));
174177
$this->line('Token Type: '.(str_starts_with($token, 'gho_') ? 'OAuth Token' : 'Personal Access Token'));
175178

0 commit comments

Comments
 (0)