ConsumeEvent   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 69
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 69
ccs 14
cts 14
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getEnvelope() 0 4 1
A setResult() 0 4 1
A getResult() 0 4 1
A shouldContinueConsuming() 0 4 1
A stopConsuming() 0 4 1
1
<?php
2
3
namespace TreeHouse\Queue\Event;
4
5
use Symfony\Contracts\EventDispatcher\Event;
6
use TreeHouse\Queue\Amqp\EnvelopeInterface;
7
8
class ConsumeEvent extends Event
9
{
10
    /**
11
     * @var EnvelopeInterface
12
     */
13
    private $envelope;
14
15
    /**
16
     * @var mixed
17
     */
18
    private $result;
19
20
    /**
21
     * @var bool
22
     */
23
    private $continueConsuming;
24
25
    /**
26
     * @param EnvelopeInterface $envelope The envelope that was consumed
27
     * @param mixed             $result   The result of the consumed message
28
     * @param bool              $continue  Whether to continue consuming or stop the thread blocking
29
     */
30 3
    public function __construct(EnvelopeInterface $envelope, $result = null, $continue = true)
31
    {
32 3
        $this->envelope = $envelope;
33 3
        $this->result = $result;
34 3
        $this->continueConsuming = $continue;
35 3
    }
36
37
    /**
38
     * @return EnvelopeInterface
39
     */
40 1
    public function getEnvelope()
41
    {
42 1
        return $this->envelope;
43
    }
44
45
    /**
46
     * @param mixed $result
47
     */
48 1
    public function setResult($result)
49
    {
50 1
        $this->result = $result;
51 1
    }
52
53
    /**
54
     * @return mixed
55
     */
56 1
    public function getResult()
57
    {
58 1
        return $this->result;
59
    }
60
61
    /**
62
     * @return bool
63
     */
64 1
    public function shouldContinueConsuming()
65
    {
66 1
        return $this->continueConsuming;
67
    }
68
69
    /**
70
     * Marks the event as to not continue consuming after this.
71
     */
72
    public function stopConsuming()
73
    {
74
        $this->continueConsuming = false;
75
    }
76
}
77