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.

Event   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 83
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Test Coverage

Coverage 88.24%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 6
c 1
b 0
f 0
lcom 0
cbo 0
dl 0
loc 83
ccs 15
cts 17
cp 0.8824
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getType() 0 4 1
A getVersion() 0 4 1
A getData() 0 4 1
A getMetadata() 0 4 1
A getEventId() 0 4 1
1
<?php
2
namespace EventStore\StreamFeed;
3
4
use EventStore\ValueObjects\Identity\UUID;
5
6
/**
7
 * Class Event
8
 * @package EventStore\StreamFeed
9
 */
10
final class Event
11
{
12
    /**
13
     * @var string
14
     */
15
    private $type;
16
17
    /**
18
     * @var integer
19
     */
20
    private $version;
21
22
    /**
23
     * @var array
24
     */
25
    private $data;
26
27
    /**
28
     * @var array
29
     */
30
    private $metadata;
31
32
    /**
33
     * @var UUID
34
     */
35
    private $eventId;
36
37
    /**
38
     * @param string  $type
39
     * @param integer $version
40
     * @param array   $data
41
     * @param array   $metadata
42
     * @param UUID    $eventId
43
     */
44 11
    public function __construct($type, $version, array $data, array $metadata = null, UUID $eventId = null)
45
    {
46 11
        $this->type = $type;
47 11
        $this->version = (integer) $version;
48 11
        $this->data = $data;
49 11
        $this->metadata = $metadata;
0 ignored issues
show
Documentation Bug introduced by
It seems like $metadata can be null. However, the property $metadata is declared as array. Maybe change the type of the property to array|null or add a type check?

Our type inference engine has found an assignment of a scalar value (like a string, an integer or null) to a property which is an array.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.

To type hint that a parameter can be either an array or null, you can set a type hint of array and a default value of null. The PHP interpreter will then accept both an array or null for that parameter.

function aContainsB(array $needle = null, array  $haystack) {
    if (!$needle) {
        return false;
    }

    return array_intersect($haystack, $needle) == $haystack;
}

The function can be called with either null or an array for the parameter $needle but will only accept an array as $haystack.

Loading history...
50 11
        $this->eventId = $eventId;
51 11
    }
52
53
    /**
54
     * @return string
55
     */
56
    public function getType()
57
    {
58
        return $this->type;
59
    }
60
61
    /**
62
     * @return integer
63
     */
64 3
    public function getVersion()
65
    {
66 3
        return $this->version;
67
    }
68
69
    /**
70
     * @return array
71
     */
72 3
    public function getData()
73
    {
74 3
        return $this->data;
75
    }
76
77
    /**
78
     * @return array
79
     */
80 3
    public function getMetadata()
81
    {
82 3
        return $this->metadata;
83
    }
84
85
    /**
86
     * @return UUID
87
     */
88 1
    public function getEventId()
89
    {
90 1
        return $this->eventId;
91
    }
92
}
93