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.
Completed
Push — master ( 5802ed...900bc8 )
by Hong
02:38
created

DefaultFormatter::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 6
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
1
<?php
2
/**
3
 * Phossa Project
4
 *
5
 * PHP version 5.4
6
 *
7
 * @category  Library
8
 * @package   Phossa2\Logger
9
 * @copyright Copyright (c) 2016 phossa.com
10
 * @license   http://mit-license.org/ MIT License
11
 * @link      http://www.phossa.com/
12
 */
13
/*# declare(strict_types=1); */
14
15
namespace Phossa2\Logger\Formatter;
16
17
use Phossa2\Logger\Entry\LogEntryInterface;
18
19
/**
20
 * DefaultFormatter
21
 *
22
 * @package Phossa2\Logger
23
 * @author  Hong Zhang <[email protected]>
24
 * @see     FormatterAbstract
25
 * @version 2.0.0
26
 * @since   2.0.0 added
27
 */
28
class DefaultFormatter extends FormatterAbstract
29
{
30
    /**
31
     * default message format
32
     *
33
     * @var    string
34
     * @access protected
35
     */
36
    protected $format = '[%datetime%] %channel%.%level%: %message%';
37
38
    /**
39
     * Inject the format if any
40
     *
41
     * @param string $format
42
     * @access protected
43
     */
44
    public function __construct(/*# string */ $format = '')
45
    {
46
        if ($format) {
47
            $this->format = $format;
48
        }
49
    }
50
51
    /**
52
     * {@inheritDoc}
53
     */
54
    protected function format(
55
        LogEntryInterface $logEntry
56
    )/*# : string */ {
57
        $data = [
58
            '%datetime%'    => date('Y-m-d H:i:s', $logEntry->getTimestamp()),
59
            '%level%'       => strtoupper($logEntry->getLevel()),
60
            '%message%'     => $logEntry->getMessage(),
61
            '%channel%'     => $logEntry->getChannel(),
62
        ];
63
        return strtr($this->format, $data);
64
    }
65
}
66