Skip to content

Commit

Permalink
Enhance doc-blocks and variable names
Browse files Browse the repository at this point in the history
  • Loading branch information
imanghafoori1 committed Oct 10, 2023
1 parent 71581e6 commit dbd23fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
22 changes: 11 additions & 11 deletions src/Rap2hpoutre/LaravelLogViewer/Level.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
class Level
{
/**
* @var array
* @var array<string, string>
*/
private $levels_classes = [
private $levelsClasses = [
'debug' => 'info',
'info' => 'info',
'notice' => 'info',
Expand All @@ -25,9 +25,9 @@ class Level
];

/**
* @var array
* @var array<string, string>
*/
private $levels_imgs = [
private $icons = [
'debug' => 'info-circle',
'info' => 'info-circle',
'notice' => 'info-circle',
Expand All @@ -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];
}
}
}
17 changes: 5 additions & 12 deletions src/Rap2hpoutre/LaravelLogViewer/Pattern.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,10 @@

namespace Rap2hpoutre\LaravelLogViewer;

/**
* Class Pattern
* @property array patterns
* @package Rap2hpoutre\LaravelLogViewer
*/

class Pattern
{

/**
* @var array
* @var array<string, string>
*/
private $patterns = [
'logs' => '/\[\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}([\+-]\d{4})?\].*/',
Expand All @@ -24,24 +17,24 @@ class Pattern
];

/**
* @return array
* @return string[]
*/
public function all()
{
return array_keys($this->patterns);
}

/**
* @param $pattern
* @param null $position
* @param string $pattern
* @param null|string $position
* @return string pattern
*/
public function getPattern($pattern, $position = null)
{
if ($position !== null) {
return $this->patterns[$pattern][$position];
}

return $this->patterns[$pattern];

}
}

0 comments on commit dbd23fd

Please sign in to comment.