Skip to content

Commit

Permalink
Refactor debug method in Utils class
Browse files Browse the repository at this point in the history
The debug method in the Utils class has been refactored to only accept string messages. Additionally, a try-catch block has been added to output the message with strip_tags function in the event of a Throwable exception, improving error-handling.
  • Loading branch information
SmetDenis committed Apr 11, 2024
1 parent a19259c commit d351cfd
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,14 @@ public static function printList(null|array|bool|float|int|string $items, string
return "[\"<{$color}>" . \implode("</{$color}>\", \"<{$color}>", $items) . "</{$color}>\"]";
}

public static function debug(int|string $message): void
public static function debug(string $message): void
{
if (self::$debugMode) {
cli($message);
try {
cli($message);
} catch (\Throwable) {
Cli::out(\strip_tags($message));
}
}
}

Expand Down

0 comments on commit d351cfd

Please sign in to comment.