From d181a234ba33a3559dfa3a33d09b6995c19f49b7 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sun, 16 Jul 2023 14:44:49 +0200 Subject: [PATCH] Add EventHandlerIssue class --- src/EventHandlerIssue.php | 50 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/EventHandlerIssue.php diff --git a/src/EventHandlerIssue.php b/src/EventHandlerIssue.php new file mode 100644 index 000000000..d685f3059 --- /dev/null +++ b/src/EventHandlerIssue.php @@ -0,0 +1,50 @@ +severe ? 'static_analysis_severe' : 'static_analysis_minor'], + "{$this->file}:{$this->line}", + $this->message + ); + } + + public function log(): void + { + Logger::log((string) $this, Logger::FATAL_ERROR); + } + + public function getHTML(): string + { + $issueStr = \htmlentities((string) $this); + $color = $this->severe ? 'red' : 'yellow'; + $warning = "

{$issueStr}

"; + return $warning; + } + + public function throw(): void + { + throw new Exception(message: (string) $this, file: $this->file, line: $this->line); + } +}