Completed
Push — master ( 9cdfd4...8c1c32 )
by Tomasz
03:32
created

SingleQueueManager   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A sendCommand() 0 7 2
A setSendDriver() 0 4 1
1
<?php
2
3
namespace Gendoria\CommandQueue\QueueManager;
4
5
use Gendoria\CommandQueue\Command\CommandInterface;
6
use Gendoria\CommandQueue\SendDriver\SendDriverInterface;
7
use RuntimeException;
8
9
/**
10
 * Simple queue manager.
11
 *
12
 */
13
class SingleQueueManager implements SingleQueueManagerInterface
14
{
15
    /**
16
     * Send driver.
17
     *
18
     * @var SendDriverInterface
19
     */
20
    private $sendDriver;
21
22
    /**
23
     * {@inheritdoc}
24
     */
25 2
    public function sendCommand(CommandInterface $command)
26
    {
27 2
        if (!$this->sendDriver) {
28 1
            throw new RuntimeException('Send driver not set');
29
        }
30 1
        $this->sendDriver->send($command);
31 1
    }
32
33
    /**
34
     * {@inheritdoc}
35
     */
36 1
    public function setSendDriver(SendDriverInterface $sendDriver)
37
    {
38 1
        $this->sendDriver = $sendDriver;
39 1
    }
40
}
41