Skip to content
This repository has been archived by the owner on Oct 5, 2021. It is now read-only.

Commit

Permalink
Merge pull request #9 from GueroSF/#take_result_generator
Browse files Browse the repository at this point in the history
#take_result_generator return result code
  • Loading branch information
arrilot authored Sep 29, 2021
2 parents 5af39cd + ee697c4 commit 9c7e36e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/Commands/GenerateClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,20 +77,22 @@ public function __construct()

/**
* Execute the console command.
*
* @return void
*/
public function handle()
public function handle(): int
{
$this->recursiveClearDirectory($this->outputDir);
$this->generateClientPackage();
if (self::FAILURE === $this->generateClientPackage()) {
return self::FAILURE;
}
$this->patchClientPackage();
$this->copyLicenseToClientPackage();

return self::SUCCESS;
}

protected abstract function patchClientPackage(): void;

private function generateClientPackage(): void
private function generateClientPackage(): int
{
$bin = 'npx @openapitools/openapi-generator-cli';
$i = escapeshellarg($this->apidocDir . DIRECTORY_SEPARATOR . "index.yaml");
Expand All @@ -100,7 +102,11 @@ private function generateClientPackage(): void

$this->info("Generating $this->client client by command: $command");

shell_exec($command);
$output = null;
$resultCode = null;
exec($command, $output, $resultCode);

return $resultCode;
}

private function getGeneratorArguments(): string
Expand Down

0 comments on commit 9c7e36e

Please sign in to comment.