From dbd23fde748e128be31958ced5eede8ca69f4429 Mon Sep 17 00:00:00 2001 From: Iman Ghafoori Date: Tue, 10 Oct 2023 13:04:34 +0330 Subject: [PATCH] Enhance doc-blocks and variable names --- src/Rap2hpoutre/LaravelLogViewer/Level.php | 22 ++++++++++---------- src/Rap2hpoutre/LaravelLogViewer/Pattern.php | 17 +++++---------- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/src/Rap2hpoutre/LaravelLogViewer/Level.php b/src/Rap2hpoutre/LaravelLogViewer/Level.php index e4bb78a..899b92a 100644 --- a/src/Rap2hpoutre/LaravelLogViewer/Level.php +++ b/src/Rap2hpoutre/LaravelLogViewer/Level.php @@ -9,9 +9,9 @@ class Level { /** - * @var array + * @var array */ - private $levels_classes = [ + private $levelsClasses = [ 'debug' => 'info', 'info' => 'info', 'notice' => 'info', @@ -25,9 +25,9 @@ class Level ]; /** - * @var array + * @var array */ - private $levels_imgs = [ + private $icons = [ 'debug' => 'info-circle', 'info' => 'info-circle', 'notice' => 'info-circle', @@ -41,28 +41,28 @@ class Level ]; /** - * @return array + * @return string[] */ public function all() { - return array_keys($this->levels_imgs); + return array_keys($this->icons); } /** - * @param $level + * @param string $level * @return string */ public function img($level) { - return $this->levels_imgs[$level]; + return $this->icons[$level]; } /** - * @param $level + * @param string $level * @return string */ public function cssClass($level) { - return $this->levels_classes[$level]; + return $this->levelsClasses[$level]; } -} \ No newline at end of file +} diff --git a/src/Rap2hpoutre/LaravelLogViewer/Pattern.php b/src/Rap2hpoutre/LaravelLogViewer/Pattern.php index bba96fe..aa292bb 100644 --- a/src/Rap2hpoutre/LaravelLogViewer/Pattern.php +++ b/src/Rap2hpoutre/LaravelLogViewer/Pattern.php @@ -2,17 +2,10 @@ namespace Rap2hpoutre\LaravelLogViewer; -/** - * Class Pattern - * @property array patterns - * @package Rap2hpoutre\LaravelLogViewer - */ - class Pattern { - /** - * @var array + * @var array */ private $patterns = [ 'logs' => '/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}([\+-]\d{4})?\].*/', @@ -24,7 +17,7 @@ class Pattern ]; /** - * @return array + * @return string[] */ public function all() { @@ -32,8 +25,8 @@ public function all() } /** - * @param $pattern - * @param null $position + * @param string $pattern + * @param null|string $position * @return string pattern */ public function getPattern($pattern, $position = null) @@ -41,7 +34,7 @@ public function getPattern($pattern, $position = null) if ($position !== null) { return $this->patterns[$pattern][$position]; } + return $this->patterns[$pattern]; - } }