Skip to content

Commit

Permalink
ClearResultCacheCommand - allow --debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed May 21, 2022
1 parent 94ec451 commit 5f5b96d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/Command/ClearResultCacheCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,29 @@ protected function configure(): void
->setDefinition([
new InputOption('configuration', 'c', InputOption::VALUE_REQUIRED, 'Path to project configuration file'),
new InputOption('autoload-file', 'a', InputOption::VALUE_REQUIRED, 'Project\'s additional autoload file path'),
new InputOption('debug', null, InputOption::VALUE_NONE, 'Show debug information - which file is analysed, do not catch internal errors'),
new InputOption('memory-limit', null, InputOption::VALUE_REQUIRED, 'Memory limit for clearing result cache'),
]);
}

protected function initialize(InputInterface $input, OutputInterface $output): void
{
if ((bool) $input->getOption('debug')) {
$application = $this->getApplication();
if ($application === null) {
throw new ShouldNotHappenException();
}
$application->setCatchExceptions(false);
return;
}
}

protected function execute(InputInterface $input, OutputInterface $output): int
{
$autoloadFile = $input->getOption('autoload-file');
$configuration = $input->getOption('configuration');
$memoryLimit = $input->getOption('memory-limit');
$debugEnabled = (bool) $input->getOption('debug');

if (
(!is_string($autoloadFile) && $autoloadFile !== null)
Expand All @@ -62,6 +76,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
null,
'0',
false,
$debugEnabled,
);
} catch (InceptionNotSuccessfulException) {
return 1;
Expand Down

0 comments on commit 5f5b96d

Please sign in to comment.