Event   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 28
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A eventHandled() 0 5 1
A hasBeenHandled() 0 4 1
1
<?php
2
declare(strict_types = 1);
3
/**
4
 * Contains Event class.
5
 *
6
 * PHP version 7.0
7
 *
8
 * LICENSE:
9
 * This file is part of Event Mediator - A general event mediator (dispatcher)
10
 * which has minimal dependencies so it is easy to drop in and use.
11
 * Copyright (C) 2015-2016 Michael Cummings
12
 *
13
 * This program is free software; you can redistribute it and/or modify it
14
 * under the terms of the GNU General Public License as published by the Free
15
 * Software Foundation; version 2 of the License.
16
 *
17
 * This program is distributed in the hope that it will be useful, but WITHOUT
18
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
19
 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
20
 * details.
21
 *
22
 * You should have received a copy of the GNU General Public License along with
23
 * this program; if not, you may write to
24
 *
25
 * Free Software Foundation, Inc.
26
 * 59 Temple Place, Suite 330
27
 * Boston, MA 02111-1307 USA
28
 *
29
 * or find a electronic copy at
30
 * <http://spdx.org/licenses/GPL-2.0.html>.
31
 *
32
 * You should also be able to find a copy of this license in the included
33
 * LICENSE file.
34
 *
35
 * @author    Michael Cummings <[email protected]>
36
 * @copyright 2015-2016 Michael Cummings
37
 * @license   GPL-2.0
38
 */
39
namespace EventMediator;
40
41
/**
42
 * Class Event
43
 */
44
class Event implements EventInterface
45
{
46
    /**
47
     * Listener uses this to let mediator know the event has been handled.
48
     *
49
     * @return EventInterface Fluent interface.
50
     */
51 2
    public function eventHandled(): EventInterface
52
    {
53 2
        $this->handled = \true;
54 2
        return $this;
55
    }
56
    /**
57
     * Used to check if event has already been handled.
58
     *
59
     * @return bool Returns true if listener claims to have handled event.
60
     */
61 2
    public function hasBeenHandled(): bool
62
    {
63 2
        return $this->handled;
64
    }
65
    /**
66
     * Used to hold handled status.
67
     *
68
     * @var bool
69
     */
70
    private $handled = \false;
71
}
72