RejectedExecutionEvent   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 79
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 6
lcom 0
cbo 2
dl 0
loc 79
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
A getJob() 0 4 1
A getEnvelope() 0 4 1
A getError() 0 4 1
A getWorker() 0 4 1
A getInfo() 0 4 1
1
<?php
2
namespace Workana\AsyncJobs\Event;
3
4
use Symfony\Component\EventDispatcher\Event;
5
use Workana\AsyncJobs\ExecutionInfo;
6
use Workana\AsyncJobs\Job;
7
use Bernard\Envelope;
8
use Workana\AsyncJobs\Worker;
9
10
/**
11
 * @author Carlos Frutos <[email protected]>
12
 */
13
class RejectedExecutionEvent extends Event
14
{
15
    /**
16
     * @var Job
17
     */
18
    protected $job;
19
20
    /**
21
     * @var Envelope
22
     */
23
    protected $envelope;
24
25
    /**
26
     * @var Exception|Throwable
27
     */
28
    protected $error;
29
30
    /**
31
     * @var Worker
32
     */
33
    protected $worker;
34
35
    /**
36
     * @var ExecutionInfo
37
     */
38
    protected $info;
39
40
    /**
41
     * @param Exception|Throwable $error
42
     */
43
    public function __construct(Envelope $envelope, $error, Worker $worker, ExecutionInfo $info)
44
    {
45
        $this->envelope = $envelope;
46
        $this->job = $envelope->getMessage();
47
        $this->error = $error;
48
        $this->worker = $worker;
49
        $this->info = $info;
50
    }
51
52
    /**
53
     * @return Job
54
     */
55
    public function getJob()
56
    {
57
        return $this->job;
58
    }
59
60
    /**
61
     * @return Envelope
62
     */
63
    public function getEnvelope()
64
    {
65
        return $this->envelope;
66
    }
67
68
    /**
69
     * @return Exception|Throwable
70
     */
71
    public function getError()
72
    {
73
        return $this->error;
74
    }
75
76
    /**
77
     * @return Worker
78
     */
79
    public function getWorker()
80
    {
81
        return $this->worker;
82
    }
83
84
    /**
85
     * @return ExecutionInfo
86
     */
87
    public function getInfo()
88
    {
89
        return $this->info;
90
    }
91
}