Skip to content

Commit

Permalink
Optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
sy-records committed Mar 26, 2024
1 parent ad6b583 commit e5d170a
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/Commands/Concerns/InstallsFrankenPhpDependencies.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ protected function ensureFrankenPhpBinaryIsInstalled()
* Download the latest version of the FrankenPHP binary.
*
* @return string
* @throws RequestException
*/
protected function downloadFrankenPhpBinary()
{
Expand All @@ -74,13 +75,10 @@ protected function downloadFrankenPhpBinary()

$response = Http::accept('application/vnd.github+json')
->withHeaders(['X-GitHub-Api-Version' => '2022-11-28'])
->get('https://api.github.com/repos/dunglas/frankenphp/releases/latest');
->get('https://api.github.com/repos/dunglas/frankenphp/releases/latest')
->throw(fn() => $this->error("Get FrankenPHP's latest release failed, see the response below:"));

$assets = $response['assets'] ?? [];
if (empty($assets)) {
$this->error("Get FrankenPHP's latest release failed, see the response below:");
throw new RequestException($response);
}

foreach ($assets as $asset) {
if ($asset['name'] !== $assetName) {
Expand Down

0 comments on commit e5d170a

Please sign in to comment.