Log   A
last analyzed

Complexity

Total Complexity 9

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 9
eloc 10
dl 0
loc 25
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getHandlers() 0 3 1
A getLaravelLogFiles() 0 11 4
A closeHandlers() 0 5 4
1
<?php
2
3
namespace Cesargb\LaravelLog\Helpers;
4
5
use Illuminate\Support\Facades\Log as LogLaravel;
6
use Monolog\Handler\RotatingFileHandler;
7
use Monolog\Handler\StreamHandler;
8
9
class Log
10
{
11
    protected static function getHandlers()
12
    {
13
        return LogLaravel::getHandlers();
14
    }
15
16
    public static function getLaravelLogFiles()
17
    {
18
        $files = [];
19
20
        foreach (self::getHandlers() as $handler) {
21
            if ($handler instanceof StreamHandler && ! $handler instanceof RotatingFileHandler) {
22
                $files[] = $handler->getUrl();
23
            }
24
        }
25
26
        return $files;
27
    }
28
29
    public static function closeHandlers()
30
    {
31
        foreach (self::getHandlers() as $handler) {
32
            if ($handler instanceof StreamHandler && ! $handler instanceof RotatingFileHandler) {
33
                $handler->close();
34
            }
35
        }
36
    }
37
}
38