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.

DefaultFormatter   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 1
dl 0
loc 38
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 2
A format() 0 11 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