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 ( f17790...0f0b7d )
by Yong
03:43
created

LogTrait::getLogFormatter()   A

Complexity

Conditions 2
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 1
nop 0
dl 0
loc 6
ccs 3
cts 3
cp 1
crap 2
rs 10
c 0
b 0
f 0
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 $logFormatter;
24
25
    /**
26
     * @param LoggerInterface $logger
27
     *
28
     * @throws Exception
29
     */
30 1
    public static function setLogger(LoggerInterface $logger)
31
    {
32 1
        self::$logger = $logger;
33 1
    }
34
35
    /**
36
     * @return LoggerInterface
37
     */
38 72
    public static function getLogger()
39
    {
40 72
        return self::$logger;
41
    }
42
43
    /**
44
     * Apache Common Log Format.
45
     *
46
     * @param string $formatter
47
     *
48
     * @link http://httpd.apache.org/docs/2.4/logs.html#common
49
     * @see  \GuzzleHttp\MessageFormatter
50
     */
51
    public static function setLogFormatter($formatter)
52
    {
53
        self::$logFormatter = $formatter;
54
    }
55
56
    /**
57
     * @return string
58
     */
59 2
    public static function getLogFormatter()
60
    {
61 2
        $pid = getmypid();
62
63
        return self::$logFormatter
64 2
            ?: "{hostname} [{date_common_log}] \"{method} {uri} HTTP/{version}\" {code} $pid";
65
    }
66
}
67