Skip to content

Commit 2754355

Browse files
committed
Tiny refactoring
1 parent 8602d6c commit 2754355

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

src/Sentry/Laravel/EventHandler.php

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ protected function commandStartingHandler(CommandStarting $event)
572572
'artisan.command',
573573
'Starting Artisan command: ' . $event->command,
574574
[
575-
'input' => $this->extractCommandInput($event->input),
575+
'input' => $this->extractConsoleCommandInput($event->input),
576576
]
577577
));
578578
}
@@ -593,21 +593,27 @@ protected function commandFinishedHandler(CommandFinished $event)
593593
'Finished Artisan command: ' . $event->command,
594594
[
595595
'exit' => $event->exitCode,
596-
'input' => $this->extractCommandInput($event->input),
596+
'input' => $this->extractConsoleCommandInput($event->input),
597597
]
598598
));
599599
}
600600

601-
Integration::configureScope(static function (Scope $scope): void {
602-
$scope->setTag('command', '');
603-
});
604-
605601
// Flush any and all events that were possibly generated by the command
606602
Integration::flushEvents();
603+
604+
Integration::configureScope(static function (Scope $scope): void {
605+
$scope->removeTag('command');
606+
});
607607
}
608608

609-
/** @return string|null */
610-
private function extractCommandInput(InputInterface $input)
609+
/**
610+
* Extract the command input arguments if possible.
611+
*
612+
* @param \Symfony\Component\Console\Input\InputInterface|null $input
613+
*
614+
* @return string|null
615+
*/
616+
private function extractConsoleCommandInput(?InputInterface $input): ?string
611617
{
612618
if ($input instanceof ArgvInput) {
613619
return (string)$input;

0 commit comments

Comments
 (0)