Passed
Pull Request — master (#2506)
by Alan
04:18
created

Event   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getContext() 0 3 1
A getData() 0 3 1
A setContext() 0 3 1
A __construct() 0 4 1
A setData() 0 3 1
1
<?php
2
3
/*
4
 * This file is part of the API Platform project.
5
 *
6
 * (c) Kévin Dunglas <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace ApiPlatform\Core\Event;
15
16
use Symfony\Component\EventDispatcher\Event as BaseEvent;
17
18
/**
19
 * @author Alan Poulain <[email protected]>
20
 */
21
abstract class Event extends BaseEvent implements EventInterface
22
{
23
    private $data;
24
    private $context;
25
26
    public function __construct($data, array $context = [])
27
    {
28
        $this->data = $data;
29
        $this->context = $context;
30
    }
31
32
    public function getData()
33
    {
34
        return $this->data;
35
    }
36
37
    public function setData($data): void
38
    {
39
        $this->data = $data;
40
    }
41
42
    public function getContext(): array
43
    {
44
        return $this->context;
45
    }
46
47
    public function setContext(array $context): void
48
    {
49
        $this->context = $context;
50
    }
51
}
52