Skip to content

Commit 503bdb9

Browse files
Code cleanup
1 parent 805d44b commit 503bdb9

1 file changed

Lines changed: 15 additions & 13 deletions

File tree

src/Runner/Config/Visualizer/Output.php

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ public function printActions(Config\Hook $config): void
220220
public function printAction(Config\Action $action): void
221221
{
222222
$this->io->write(' - <fg=cyan>' . $action->getLabel() . '</>');
223-
if ($action->hasLabel() && $this->settings->show(Settings::OPT_ACTIONS)) {
223+
if ($this->extendedAction($action)) {
224224
$this->io->write(' <fg=gray>' . $action->getAction() . '</>');
225225
}
226226
$this->printOptions($action->getOptions());
@@ -318,21 +318,16 @@ public function printOption(string $key, mixed $value, string $prefix = ''): voi
318318
if (is_array($value)) {
319319
$value = implode(', ', $value);
320320
}
321-
$this->io->write(
322-
$prefix . ' - ' . $key . ': <fg=gray>' .
323-
Util::escapeLineBreaks($value) .
324-
'</>'
325-
);
321+
$this->io->write($prefix . ' - ' . $key . ': <fg=gray>' . Util::escapeLineBreaks($value) . '</>');
326322
}
327323

328324
/**
329325
* Print the action config settings
330326
*
331327
* @param \CaptainHook\App\Config\Action $action
332-
* @param string $prefix
333328
* @return void
334329
*/
335-
public function printActionConfig(Config\Action $action, string $prefix = ''): void
330+
public function printActionConfig(Config\Action $action): void
336331
{
337332
if (!$this->settings->show(Settings::OPT_CONFIG)) {
338333
return;
@@ -350,11 +345,18 @@ public function printActionConfig(Config\Action $action, string $prefix = ''): v
350345
}
351346
$this->io->write(' <comment>Config:</comment>');
352347
foreach ($config as $key => $value) {
353-
$this->io->write(
354-
' - ' . $key . ': <fg=gray>' .
355-
Util::escapeLineBreaks((string)$value) .
356-
'</>'
357-
);
348+
$this->io->write(' - ' . $key . ': <fg=gray>' . Util::escapeLineBreaks((string)$value) . '</>');
358349
}
359350
}
351+
352+
/**
353+
* Check if actions extended information should be displayed
354+
*
355+
* @param \CaptainHook\App\Config\Action $action
356+
* @return bool
357+
*/
358+
private function extendedAction(Config\Action $action): bool
359+
{
360+
return $action->hasLabel() && $this->settings->show(Settings::OPT_ACTIONS);
361+
}
360362
}

0 commit comments

Comments
 (0)