GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( a561c9...ca8e01 )
by Yong
03:36
created

LogTrait   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 50
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
eloc 8
dl 0
loc 50
ccs 9
cts 9
cp 1
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A setLogger() 0 3 1
A setLogFormat() 0 3 1
A getLogFormat() 0 4 2
A getLogger() 0 3 1
1
<?php
2
3
namespace AlibabaCloud\Client\Traits;
4
5
use Exception;
6
use Psr\Log\LoggerInterface;
7
8
/**
9
 * Trait LogTrait
10
 *
11
 * @package AlibabaCloud\Client\Traits
12
 */
13
trait LogTrait
14
{
15
    /**
16
     * @var LoggerInterface
17
     */
18
    private static $logger;
19
20
    /**
21
     * @var string
22
     */
23
    private static $logFormat;
24
25
    /**
26
     * @return LoggerInterface
27
     */
28 63
    public static function getLogger()
29
    {
30 63
        return self::$logger;
31
    }
32
33
    /**
34
     * @param LoggerInterface $logger
35
     *
36
     * @throws Exception
37
     */
38 1
    public static function setLogger(LoggerInterface $logger)
39
    {
40 1
        self::$logger = $logger;
41 1
    }
42
43
    /**
44
     * @return string
45
     */
46 2
    public static function getLogFormat()
47
    {
48
        return self::$logFormat
49 2
            ?: '"{method} {uri} HTTP/{version}" {code} {cost} {hostname} {pid}';
50
    }
51
52
    /**
53
     * Apache Common Log Format.
54
     *
55
     * @param string $formatter
56
     *
57
     * @link http://httpd.apache.org/docs/2.4/logs.html#common
58
     * @see  \GuzzleHttp\MessageFormatter
59
     */
60 1
    public static function setLogFormat($formatter)
61
    {
62 1
        self::$logFormat = $formatter;
63 1
    }
64
}
65