Log   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
eloc 6
c 1
b 0
f 0
dl 0
loc 48
ccs 10
cts 10
cp 1
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A logPrintf() 0 3 1
A setLogger() 0 3 1
A logPrint() 0 3 1
A getLogger() 0 3 1
1
<?php
2
0 ignored issues
show
Coding Style introduced by
Missing file doc comment
Loading history...
3
declare(strict_types=1);
4
5
namespace Casbin\Log;
6
7
use Casbin\Log\Logger\DefaultLogger;
8
9
/**
10
 * Class Log.
11
 *
12
 * @author [email protected]
0 ignored issues
show
Coding Style introduced by
Content of the @author tag must be in the form "Display Name <[email protected]>"
Loading history...
13
 */
0 ignored issues
show
Coding Style introduced by
Missing @category tag in class comment
Loading history...
Coding Style introduced by
Missing @package tag in class comment
Loading history...
Coding Style introduced by
Missing @license tag in class comment
Loading history...
Coding Style introduced by
Missing @link tag in class comment
Loading history...
14
class Log
15
{
16
    /**
17
     * $logger.
18
     *
19
     * @var Logger
20
     */
21
    public static $logger;
22
23
    /**
24
     * Sets the current logger.
25
     *
26
     * @param Logger $l
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
27
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
28 4
    public static function setLogger(Logger $l): void
29
    {
30 4
        self::$logger = $l;
31 2
    }
32
33
    /**
34
     * Returns the current logger.
35
     *
36
     * @return Logger
37
     */
38 210
    public static function getLogger(): Logger
39
    {
40 210
        return self::$logger;
41
    }
42
43
    /**
44
     * Prints the log.
45
     *
46
     * @param mixed ...$v
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
47
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
48 336
    public static function logPrint(...$v): void
49
    {
50 336
        self::$logger->write(...$v);
51 224
    }
52
53
    /**
54
     * Prints the log with the format.
55
     *
56
     * @param string $format
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
57
     * @param mixed  ...$v
0 ignored issues
show
Coding Style introduced by
Missing parameter comment
Loading history...
58
     */
0 ignored issues
show
Coding Style introduced by
Missing @return tag in function comment
Loading history...
59 333
    public static function logPrintf(string $format, ...$v): void
60
    {
61 333
        self::$logger->writef($format, ...$v);
62 222
    }
63
}
64
65
Log::setLogger(new DefaultLogger());
66