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.

WritableEvent   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 60
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 3
c 1
b 0
f 0
lcom 1
cbo 1
dl 0
loc 60
ccs 13
cts 13
cp 1
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A newInstance() 0 4 1
A __construct() 0 7 1
A toStreamData() 0 9 1
1
<?php
2
namespace EventStore;
3
4
use EventStore\ValueObjects\Identity\UUID;
5
6
/**
7
 * Class WritableEvent
8
 * @package EventStore
9
 */
10
final class WritableEvent implements WritableToStream
11
{
12
    /**
13
     * @var UUID
14
     */
15
    private $uuid;
16
17
    /**
18
     * @var string
19
     */
20
    private $type;
21
22
    /**
23
     * @var array
24
     */
25
    private $data;
26
27
    /**
28
     * @var array
29
     */
30
    private $metadata;
31
32
    /**
33
     * @param  string        $type
34
     * @param  array         $data
35
     * @param  array         $metadata
36
     * @return WritableEvent
37
     */
38 25
    public static function newInstance($type, array $data, array $metadata = [])
39
    {
40 25
        return new self(new UUID(), $type, $data, $metadata);
41
    }
42
43
    /**
44
     * @param UUID   $uuid
45
     * @param string $type
46
     * @param array  $data
47
     * @param array  $metadata
48
     */
49 27
    public function __construct(UUID $uuid, $type, array $data, array $metadata = [])
50
    {
51 27
        $this->uuid = $uuid;
52 27
        $this->type = $type;
53 27
        $this->data = $data;
54 27
        $this->metadata = $metadata;
55 27
    }
56
57
    /**
58
     * @return array
59
     */
60 27
    public function toStreamData()
61
    {
62
        return [
63 27
            'eventId'   => $this->uuid->toNative(),
64 27
            'eventType' => $this->type,
65 27
            'data'      => $this->data,
66 27
            'metadata'  => $this->metadata
67
        ];
68
    }
69
}
70