Event::stop()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
* This file is part of the moss-storage package
5
*
6
* (c) Michal Wachowski <[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
namespace Moss\Storage\Query\EventDispatcher;
13
14
/**
15
 * Event for event dispatcher
16
 *
17
 * @author  Michal Wachowski <[email protected]>
18
 * @package Moss\Storage
19
 */
20
final class Event
21
{
22
    private $event;
23
    private $stop = false;
24
    private $subject;
25
26
    /**
27
     * Constructor
28
     *
29
     * @param string $event
30
     * @param mixed $subject
31
     */
32
    public function __construct($event, $subject)
33
    {
34
        $this->event = $event;
35
        $this->subject = $subject;
36
    }
37
38
    /**
39
     * Returns event name
40
     *
41
     * @return string
42
     */
43
    public function event()
44
    {
45
        return $this->event;
46
    }
47
48
    /**
49
     * Stops event propagation
50
     */
51
    public function stop()
52
    {
53
        $this->stop = true;
54
    }
55
56
    /**
57
     * Returns true if event propagation
58
     *
59
     * @return mixed
60
     */
61
    public function isStopped()
62
    {
63
        return $this->stop;
64
    }
65
66
    /**
67
     * Returns subject instance
68
     *
69
     * @return mixed
70
     */
71
    public function getSubject()
72
    {
73
        return $this->subject;
74
    }
75
76
    /**
77
     * Sets subject
78
     *
79
     * @param mixed $subject
80
     */
81
    public function setSubject($subject)
82
    {
83
        $this->subject = $subject;
84
    }
85
}
86