Passed
Pull Request — master (#259)
by Arnaud
07:04 queued 03:50
created

FieldConfigurationEvent   A

Complexity

Total Complexity 8

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Test Coverage

Coverage 39.13%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 8
eloc 18
c 1
b 0
f 0
dl 0
loc 55
ccs 9
cts 23
cp 0.3913
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A getOptions() 0 3 1
A __construct() 0 12 1
A getType() 0 3 1
A getFieldName() 0 3 1
A getContext() 0 3 1
A setType() 0 3 1
A getField() 0 3 1
A setOptions() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace LAG\AdminBundle\Event\Events\Configuration;
6
7
use LAG\AdminBundle\Field\FieldInterface;
8
use Symfony\Contracts\EventDispatcher\Event;
9
10
class FieldConfigurationEvent extends Event
11
{
12
    private string $fieldName;
13
    private ?string $type;
14
    private ?FieldInterface $field;
15
    private array $options;
16
    private array $context;
17
18 7
    public function __construct(
19
        string $fieldName,
20
        string $type = null,
21
        array $options = [],
22
        array $context = [],
23
        FieldInterface $field = null
24
    ) {
25 7
        $this->fieldName = $fieldName;
26 7
        $this->type = $type;
27 7
        $this->field = $field;
28 7
        $this->options = $options;
29 7
        $this->context = $context;
30 7
    }
31
32
    public function setType(string $type): void
33
    {
34
        $this->type = $type;
35
    }
36
37
    public function getType(): ?string
38
    {
39
        return $this->type;
40
    }
41
42
    public function setOptions(array $options): void
43
    {
44
        $this->options = $options;
45
    }
46
47 7
    public function getOptions(): array
48
    {
49 7
        return $this->options;
50
    }
51
52
    public function getFieldName(): string
53
    {
54
        return $this->fieldName;
55
    }
56
57
    public function getField(): ?FieldInterface
58
    {
59
        return $this->field;
60
    }
61
62
    public function getContext(): array
63
    {
64
        return $this->context;
65
    }
66
}
67