Skip to content

Commit

Permalink
Fix CS
Browse files Browse the repository at this point in the history
  • Loading branch information
hlecorche committed Nov 22, 2024
1 parent c2f05fb commit 06db2eb
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
18 changes: 9 additions & 9 deletions src/Command/ManageCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
$availableActions = ['start', 'stop', 'status'];
$action = $input->getArgument('action');
if (!\in_array($action, $availableActions)) {
$output->writeln(sprintf('<error>Bad action "%s" (Available: %s)</error>', $action, implode(', ', $availableActions)));
$output->writeln(\sprintf('<error>Bad action "%s" (Available: %s)</error>', $action, implode(', ', $availableActions)));

return 1;
}
Expand All @@ -68,7 +68,7 @@ protected function execute(InputInterface $input, OutputInterface $output): int
sort($availablePrograms);
foreach ($programs as $program) {
if (!\in_array($program, $availablePrograms) && 'all' !== $program) {
$output->writeln(sprintf('<error>Bad program "%s" (Available: %s)</error>', $program, implode(', ', array_merge($availablePrograms, ['all']))));
$output->writeln(\sprintf('<error>Bad program "%s" (Available: %s)</error>', $program, implode(', ', array_merge($availablePrograms, ['all']))));

return 1;
}
Expand All @@ -92,9 +92,9 @@ protected function execute(InputInterface $input, OutputInterface $output): int
protected function startAction(array $programs, OutputInterface $output): int
{
foreach ($programs as $program) {
$output->writeln(sprintf('Starting %s program', $program));
$output->writeln(\sprintf('Starting %s program', $program));
$this->supervisor->startProgram($program);
$output->writeln(sprintf('%s program is started', $program));
$output->writeln(\sprintf('%s program is started', $program));
}

return 0;
Expand All @@ -103,9 +103,9 @@ protected function startAction(array $programs, OutputInterface $output): int
protected function stopAction(array $programs, OutputInterface $output): int
{
foreach ($programs as $program) {
$output->writeln(sprintf('Stopping %s program', $program));
$output->writeln(\sprintf('Stopping %s program', $program));
$this->supervisor->stopProgram($program);
$output->writeln(sprintf('%s program is stopped', $program));
$output->writeln(\sprintf('%s program is stopped', $program));
}

return 0;
Expand Down Expand Up @@ -136,7 +136,7 @@ protected function statusAction(array $programs, InputInterface $input, OutputIn
$rows[] = ['Program', $programName];
$rows[] = ['Transport(s)', implode(', ', $transports)];
$rows[] = ['Process', $supervisorProcess['name']];
$rows[] = ['State', sprintf('<%s>%s</%s>', $color, $supervisorProcess['statename'], $color)];
$rows[] = ['State', \sprintf('<%s>%s</%s>', $color, $supervisorProcess['statename'], $color)];
$rows[] = ['PID', $supervisorProcess['pid']];
$rows[] = new TableSeparator();
if (!$supervisorProcess->isRunning()) {
Expand Down Expand Up @@ -171,12 +171,12 @@ protected function nagiosStatusAction(array $programs, InputInterface $input, Ou
}

if ($stoppedProcesses > 0) {
$output->writeln(sprintf('CRITICAL - Running processes: %s Stopped processes: %s', $runningProcesses, $stoppedProcesses));
$output->writeln(\sprintf('CRITICAL - Running processes: %s Stopped processes: %s', $runningProcesses, $stoppedProcesses));

return 2;
}

$output->writeln(sprintf('OK - Running processes: %s Stopped processes: %s', $runningProcesses, $stoppedProcesses));
$output->writeln(\sprintf('OK - Running processes: %s Stopped processes: %s', $runningProcesses, $stoppedProcesses));

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion src/EventListener/WorkerMessageFailedEventListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected function stopProcess(WorkerMessageFailedEvent $event, array $transport

try {
if ($this->logger) {
$this->logger->info(sprintf('Stopping %s program', $transportInfos['program']));
$this->logger->info(\sprintf('Stopping %s program', $transportInfos['program']));
}
$this->supervisor->stopProgram($transportInfos['program'], false);
} catch (\Throwable $throwable) {
Expand Down
2 changes: 1 addition & 1 deletion src/Mailer/ErrorEmailBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ protected function getContext(WorkerMessageFailedEvent $event, array $transportI

protected function getThrowableMessage(\Throwable $throwable): string
{
return sprintf('%s: %s at %s line %s', $throwable::class, $throwable->getMessage(), $throwable->getFile(), $throwable->getLine());
return \sprintf('%s: %s at %s line %s', $throwable::class, $throwable->getMessage(), $throwable->getFile(), $throwable->getLine());
}

public function getSubject(WorkerMessageFailedEvent $event, array $transportInfos, array $mailerParameters, bool $stop): string
Expand Down
2 changes: 1 addition & 1 deletion src/Supervisor/SupervisorApiFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,6 @@ public static function createSupervisor(array $supervisorParameters): Supervisor

protected static function getUrl(string $host, int $port): string
{
return sprintf('http://%s:%s/RPC2', $host, $port);
return \sprintf('http://%s:%s/RPC2', $host, $port);
}
}

0 comments on commit 06db2eb

Please sign in to comment.