SuccessfulExecutionEvent::getJob()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
namespace Workana\AsyncJobs\Event;
3
4
use Bernard\Envelope;
5
use Symfony\Component\EventDispatcher\Event;
6
use Workana\AsyncJobs\ExecutionInfo;
7
use Workana\AsyncJobs\Worker;
8
9
/**
10
 * Occurs after successful execution
11
 *
12
 * @author Carlos Frutos <[email protected]>
13
 */
14
class SuccessfulExecutionEvent extends Event
15
{
16
    /**
17
     * @var Envelope
18
     */
19
    protected $envelope;
20
21
    /**
22
     * @var Worker
23
     */
24
    protected $worker;
25
26
    /**
27
     * @var ExecutionInfo
28
     */
29
    protected $info;
30
31
    /**
32
     * SuccessfulExecutionEvent constructor.
33
     * @param Envelope $envelope
34
     * @param Worker $worker
35
     */
36
    public function __construct(Envelope $envelope, Worker $worker, ExecutionInfo $info)
37
    {
38
        $this->envelope = $envelope;
39
        $this->worker = $worker;
40
        $this->info = $info;
41
    }
42
43
    /**
44
     * @return Envelope
45
     */
46
    public function getEnvelope()
47
    {
48
        return $this->envelope;
49
    }
50
51
    /**
52
     * @return \Workana\AsyncJobs\Job
53
     */
54
    public function getJob()
55
    {
56
        return $this->envelope->getMessage();
57
    }
58
59
    /**
60
     * @return Worker
61
     */
62
    public function getWorker()
63
    {
64
        return $this->worker;
65
    }
66
67
    /**
68
     * @return ExecutionInfo
69
     */
70
    public function getInfo()
71
    {
72
        return $this->info;
73
    }
74
}