AbstractEvent::setEventName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
ccs 3
cts 3
cp 1
cc 1
nc 1
nop 1
crap 1
1
<?php
2
3
/*
4
 * This file is part of the core-bundle package.
5
 *
6
 * (c) 2018 WEBEWEB
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
namespace WBW\Bundle\CoreBundle\Event;
13
14
use Symfony\Contracts\EventDispatcher\Event as BaseEvent;
15
16
/**
17
 * Abstract event.
18
 *
19
 * @author webeweb <https://github.com/webeweb>
20
 * @package WBW\Bundle\CoreBundle\Event
21
 * @abstract
22
 */
23
abstract class AbstractEvent extends BaseEvent {
24
25
    /**
26
     * Event name.
27
     *
28
     * @var string
29
     */
30
    private $eventName;
31
32
    /**
33
     * Constructor.
34
     *
35
     * @param string $eventName The event name.
36
     */
37 100
    protected function __construct(string $eventName) {
38 100
        $this->setEventName($eventName);
39 100
    }
40
41
    /**
42
     * Get the event name.
43
     *
44
     * @return string Returns the event name.
45
     */
46 50
    public function getEventName(): string {
47 50
        return $this->eventName;
48
    }
49
50
    /**
51
     * Set the event name.
52
     *
53
     * @param string $eventName The event name.
54
     * @return AbstractEvent Returns this event.
55
     */
56 100
    protected function setEventName(string $eventName): AbstractEvent {
57 100
        $this->eventName = $eventName;
58 100
        return $this;
59
    }
60
}
61