Inline many variables.

This commit is contained in:
Lucas Michot
2024-10-31 18:20:11 +01:00
parent aa7fa16c74
commit 1ec224fde1
20 changed files with 34 additions and 79 deletions

View File

@@ -43,14 +43,13 @@ function generate_github_jwt_token(GithubApp $source)
$tokenBuilder = (new Builder(new JoseEncoder, ChainedFormatter::default()));
$now = CarbonImmutable::now();
$now = $now->setTime($now->format('H'), $now->format('i'));
$issuedToken = $tokenBuilder
return $tokenBuilder
->issuedBy($source->app_id)
->issuedAt($now->modify('-1 minute'))
->expiresAt($now->modify('+10 minutes'))
->getToken($algorithm, $signingKey)
->toString();
return $issuedToken;
}
function githubApi(GithubApp|GitlabApp|null $source, string $endpoint, string $method = 'get', ?array $data = null, bool $throwError = true)