Completed
Pull Request — master (#9)
by Adam
02:20
created

AbstractOptions   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 2

Test Coverage

Coverage 37.5%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 4
c 2
b 0
f 0
lcom 2
cbo 2
dl 0
loc 46
ccs 3
cts 8
cp 0.375
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A command() 0 8 2
A queue() 0 8 2
1
<?php
2
3
namespace Equip\Queue;
4
5
use Equip\Command\OptionsInterface;
6
use Equip\Command\OptionsSerializerTrait;
7
use Equip\Queue\Exception\MessageException;
8
9
abstract class AbstractOptions implements OptionsInterface
10
{
11
    use OptionsSerializerTrait;
12
13
    /**
14
     * @var string
15
     */
16
    protected $command;
17
18
    /**
19
     * @var string
20
     */
21
    protected $queue;
22
23
    /**
24
     * Returns the command name
25
     *
26
     * @return string
27
     *
28
     * @throws MessageException If the handler property isn't set
29
     */
30
    public function command()
31
    {
32
        if (!$this->command) {
33
            throw MessageException::missingProperty('command');
34
        }
35
36
        return $this->command;
37
    }
38
39
    /**
40
     * Returns the queue name
41
     *
42
     * @return string
43
     *
44
     * @throws MessageException If the queue property isn't set
45
     */
46 1
    public function queue()
47
    {
48 1
        if (!$this->queue) {
49
            throw MessageException::missingProperty('queue');
50
        }
51
52 1
        return $this->queue;
53
    }
54
}
55