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.

LogEntryPrototypeTrait   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setLogEntryPrototype() 0 5 1
A newLogEntry() 0 18 2
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\Entry;
16
17
/**
18
 * LogEntryPrototypeTrait
19
 *
20
 * @package Phossa2\Logger
21
 * @author  Hong Zhang <[email protected]>
22
 * @see     LogEntryPrototypeInterface
23
 * @version 2.0.0
24
 * @since   2.0.0 added
25
 */
26
trait LogEntryPrototypeTrait
27
{
28
    /**
29
     * log entry prototype
30
     *
31
     * @var    LogEntryInterface
32
     * @access protected
33
     */
34
    protected $entry_proto;
35
36
    /**
37
     * {@inheritDoc}
38
     */
39
    public function setLogEntryPrototype(LogEntryInterface $logEntry = null)
40
    {
41
        $this->entry_proto = $logEntry;
42
        return $this;
43
    }
44
45
    /**
46
     * Create a log entry
47
     *
48
     * @param  string $channel
49
     * @param  string $level
50
     * @param  string $message
51
     * $param  array $context
52
     * @return LogEntryInterface
53
     * @access protected
54
     */
55
    protected function newLogEntry(
56
        /*# string */ $channel,
57
        /*# string */ $level,
58
        /*# string */ $message,
59
        array $context = []
60
    )/*# : EventInterface */ {
61
        if (is_null($this->entry_proto)) {
62
            return new LogEntry($channel, $level, $message, $context);
63
        } else {
64
            $entry = clone $this->entry_proto;
65
            return $entry
66
                ->setChannel($channel)
67
                ->setLevel($level)
68
                ->setMessage($message)
69
                ->setContext($context)
70
                ->setTimestamp();
71
        }
72
    }
73
}
74