QueueWorkerRunEvent   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 48
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 1
dl 0
loc 48
ccs 8
cts 8
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 2
A getSubsystem() 0 4 1
A getWorker() 0 4 1
1
<?php
2
3
namespace Gendoria\CommandQueueBundle\Event;
4
5
use Gendoria\CommandQueue\Worker\WorkerInterface;
6
use Symfony\Component\EventDispatcher\Event;
7
8
/**
9
 * Event raised, when queue worker is run.
10
 *
11
 * @author Tomasz Struczyński <[email protected]>
12
 */
13
abstract class QueueWorkerRunEvent extends Event
14
{
15
    /**
16
     * Subsystem name.
17
     *
18
     * @var string|null
19
     */
20
    private $subsystem;
21
    
22
    /**
23
     * Worker processing this request.
24
     * 
25
     * @var WorkerInterface
26
     */
27
    private $worker;
28
29
    /**
30
     * Class constructor.
31
     *
32
     * @param WorkerInterface $worker Worker processing this command.
33
     * @param string          $subsystem Subsystem name.
34
     */
35 8
    public function __construct(WorkerInterface $worker, $subsystem = null)
36
    {
37 8
        $this->worker = $worker;
38 8
        $this->subsystem = $subsystem ? (string) $subsystem : null;
39 8
    }
40
41
    /**
42
     * Get subsystem name.
43
     *
44
     * @return string|null
45
     */
46 2
    public function getSubsystem()
47
    {
48 2
        return $this->subsystem;
49
    }
50
    
51
    /**
52
     * Get worker processing this request.
53
     * 
54
     * @return WorkerInterface
55
     */
56 2
    public function getWorker()
57
    {
58 2
        return $this->worker;
59
    }
60
}
61