Skip to content

Commit

Permalink
Replaced Command::(SUCCESS|FAILURE) with self::(SUCCESS|FAILURE)
Browse files Browse the repository at this point in the history
  • Loading branch information
alongosz committed Aug 9, 2024
1 parent 4c5b3f4 commit a7a8bcd
Show file tree
Hide file tree
Showing 14 changed files with 40 additions and 40 deletions.
2 changes: 1 addition & 1 deletion src/bundle/Core/Command/CheckURLsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}
$progress->finish();

return Command::SUCCESS;
return self::SUCCESS;
}

private function getTotalCount(): int
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/CleanupVersionsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($contentIdsCount === 0) {
$output->writeln('<info>There is no content matching the given Criteria.</info>');

return Command::SUCCESS;
return self::SUCCESS;
}

$output->writeln(sprintf(
Expand Down Expand Up @@ -229,7 +229,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$contentIdsCount
));

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/CopySubtreeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);

if (!$input->getOption('no-interaction') && !$questionHelper->ask($input, $output, $question)) {
return Command::SUCCESS;
return self::SUCCESS;
}

$this->locationService->copySubtree(
Expand All @@ -164,7 +164,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
'<info>Finished</info>'
);

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/DebugConfigResolverCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('json')) {
$output->write(json_encode($parameterData));

return Command::SUCCESS;
return self::SUCCESS;
}

$output->writeln('<comment>SiteAccess name:</comment> ' . $this->siteAccess->name);
Expand All @@ -112,6 +112,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return Command::SUCCESS;
return self::SUCCESS;
}
}
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/DeleteContentTranslationCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->repository->rollback();
$this->output->writeln('Reverting and aborting.');

return Command::SUCCESS;
return self::SUCCESS;
}

// Delete Translation
Expand All @@ -144,7 +144,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
throw $e;
}

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/ExpireUserPasswordsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($totalCount === 0) {
$output->writeln('<info>There are no users matching given criteria</info>');

return Command::SUCCESS;
return self::SUCCESS;
}

$output->writeln(sprintf(
Expand Down Expand Up @@ -213,7 +213,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
);
}

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/bundle/Core/Command/NormalizeImagesPathsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($imagePathsToNormalizeCount === 0) {
$io->success('No paths to normalize.');

return Command::SUCCESS;
return self::SUCCESS;
}

if (!$io->confirm('Do you want to continue?')) {
return Command::SUCCESS;
return self::SUCCESS;
}

$io->writeln('Normalizing image paths. Please wait...');
Expand All @@ -136,7 +136,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$io->progressFinish();
$io->success('Done!');

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
8 changes: 4 additions & 4 deletions src/bundle/Core/Command/RegenerateUrlAliasesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static function (Repository $repository): int {
if ($locationsCount === 0) {
$output->writeln('<info>No location was found. Exiting.</info>');

return Command::SUCCESS;
return self::SUCCESS;
}

if (!$input->getOption('no-interaction')) {
Expand All @@ -140,10 +140,10 @@ static function (Repository $repository): int {
false
);
if (!$helper->ask($input, $output, $question)) {
return Command::SUCCESS;
return self::SUCCESS;
}
} elseif (!$input->getOption('force')) {
return Command::FAILURE;
return self::FAILURE;
}

$this->regenerateSystemUrlAliases($output, $locationsCount, $locationIds, $iterationCount);
Expand All @@ -157,7 +157,7 @@ static function (Repository $repository): int {
$output->writeln("<info>Done. Deleted {$corruptedAliasesCount} entries.</info>");
$output->writeln('<comment>Make sure to clear HTTP cache.</comment>');

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions src/bundle/Core/Command/ReindexCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
EOT);

if (!$io->confirm('Continue?', true)) {
return Command::SUCCESS;
return self::SUCCESS;
}
}

Expand All @@ -232,7 +232,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
return $this->indexIncrementally($input, $output, $iterationCount, $commit);
}

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
10 changes: 5 additions & 5 deletions src/bundle/Core/Command/ResizeOriginalImagesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return Command::SUCCESS;
return self::SUCCESS;
}

try {
Expand All @@ -170,7 +170,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return Command::SUCCESS;
return self::SUCCESS;
}

$query = new Query();
Expand All @@ -195,13 +195,13 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return Command::SUCCESS;
return self::SUCCESS;
}

$helper = $this->getHelper('question');
$question = new ConfirmationQuestion('<question>The changes you are going to perform cannot be undone. Remember to do a proper backup before. Would you like to continue?</question> ', false);
if (!$helper->ask($input, $output, $question)) {
return Command::SUCCESS;
return self::SUCCESS;
}

$progressBar = new ProgressBar($output, $totalCount);
Expand All @@ -228,7 +228,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
)
);

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/bundle/Core/Command/UpdateTimestampsToUTCCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,17 +153,17 @@ protected function execute(InputInterface $input, OutputInterface $output): int
sprintf('The selected mode is not supported. Use one of the following modes: %s', implode(', ', array_keys(self::MODES)))
);

return Command::SUCCESS;
return self::SUCCESS;
}

$from = $input->getOption('from');
$to = $input->getOption('to');

if ($from && !$this->validateDateTimeString($from, $output)) {
return Command::SUCCESS;
return self::SUCCESS;
}
if ($to && !$this->validateDateTimeString($to, $output)) {
return Command::SUCCESS;
return self::SUCCESS;
}
if ($from) {
$this->from = $this->dateStringToTimestamp($from);
Expand Down Expand Up @@ -195,7 +195,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($count == 0) {
$output->writeln('Nothing to process, exiting.');

return Command::SUCCESS;
return self::SUCCESS;
}

$helper = $this->getHelper('question');
Expand All @@ -207,7 +207,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!$helper->ask($input, $output, $question)) {
$output->writeln('');

return Command::SUCCESS;
return self::SUCCESS;
}

$progressBar = $this->getProgressBar($count, $output);
Expand Down Expand Up @@ -256,7 +256,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
]);
}

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/bundle/IO/Command/MigrateFilesCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,14 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($input->getOption('list-io-handlers')) {
$this->outputConfiguredHandlers($output);

return Command::SUCCESS;
return self::SUCCESS;
}

$bulkCount = (int)$input->getOption('bulk-count');
if ($bulkCount < 1) {
$output->writeln('The value for --bulk-count must be a positive integer.');

return Command::SUCCESS;
return self::SUCCESS;
}

$output->writeln($this->getProcessedHelp());
Expand All @@ -124,7 +124,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
}

if (!$this->validateHandlerOptions($fromHandlers, $toHandlers, $output)) {
return Command::SUCCESS;
return self::SUCCESS;
}

$output->writeln([
Expand Down Expand Up @@ -159,7 +159,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if ($totalCount === 0) {
$output->writeln('Nothing to process.');

return Command::SUCCESS;
return self::SUCCESS;
}

if (!$input->getOption('no-interaction')) {
Expand All @@ -172,7 +172,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!$helper->ask($input, $output, $question)) {
$output->writeln('Aborting.');

return Command::SUCCESS;
return self::SUCCESS;
}
}

Expand All @@ -183,7 +183,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output
);

return Command::SUCCESS;
return self::SUCCESS;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
if (!empty($schemaManager->listTables())) {
$io = new SymfonyStyle($input, $output);
if (!$io->confirm('Running this command will delete data in all Ibexa generated tables. Continue?')) {
return Command::SUCCESS;
return self::SUCCESS;
}
}

Expand All @@ -114,7 +114,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$this->indexData($output, $siteaccess);
}

return Command::SUCCESS;
return self::SUCCESS;
}

private function checkPermissions()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,6 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$output->writeln('OK - <info>All users have supported password hash types</info>');
}

return Command::SUCCESS;
return self::SUCCESS;
}
}

0 comments on commit a7a8bcd

Please sign in to comment.