Event   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 51
rs 10

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getTarget() 0 4 1
A isCancelled() 0 4 1
A setTarget() 0 5 1
A cancel() 0 9 1
1
<?php
2
3
namespace Sokil\FraudDetector;
4
5
class Event extends \Symfony\Component\EventDispatcher\Event
6
{
7
    /**
8
     * @var mixed $target target object, on which event is fired
9
     */
10
    private $_target;
11
12
    private $_cancelled = false;
13
14
    /**
15
     * Set target object, on which event is fired
16
     * @param mixed $target
17
     * @return \Sokil\Mongo\Event
18
     */
19
    public function setTarget($target)
20
    {
21
        $this->_target = $target;
22
        return $this;
23
    }
24
25
    /**
26
     * Get target object, on which event is fired
27
     * @return mixed
28
     */
29
    public function getTarget()
30
    {
31
        return $this->_target;
32
    }
33
34
    /**
35
     * Check if operation execution cancelled
36
     */
37
    public function isCancelled()
38
    {
39
        return $this->_cancelled;
40
    }
41
42
    /**
43
     * Cancel related operation execution. If called as beforeInsert
44
     * handler, than insert will be cancelled.
45
     */
46
    public function cancel()
47
    {
48
        $this->_cancelled = true;
49
50
        // propagation already not need
51
        $this->stopPropagation();
52
53
        return $this;
54
    }
55
}