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.

UidProcessor   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
A __invoke() 0 6 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\Processor;
16
17
use Phossa2\Logger\Entry\LogEntryInterface;
18
19
/**
20
 * UidProcessor
21
 *
22
 * Inject an unique id for this session. Should be the first processor ?
23
 *
24
 * @package Phossa2\Logger
25
 * @author  Hong Zhang <[email protected]>
26
 * @see     ProcessorAbstract
27
 * @version 2.0.0
28
 * @since   2.0.0 added
29
 */
30
class UidProcessor extends ProcessorAbstract
31
{
32
    /**
33
     * @var    string
34
     * @access protected
35
     */
36
    protected $uid;
37
38
    /**
39
     * Using external uid or create one
40
     *
41
     * @param  string $uid external one
42
     * @param  int $length uid length
43
     * @access public
44
     */
45
    public function __construct(/*# string */ $uid = '', /*# int */ $length = 8)
46
    {
47
        if (empty($uid)) {
48
            $uid = substr(hash('md5', uniqid('', true)), 0, $length);
49
        }
50
        $this->uid = $uid;
51
    }
52
53
    /**
54
     * {@inheritDoc}
55
     */
56
    public function __invoke(LogEntryInterface $logEntry)
57
    {
58
        $context = $logEntry->getContext();
59
        $context['uid'] = $this->uid;
60
        $logEntry->setContext($context);
61
    }
62
}
63