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

AbstractOptions::queue()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2.0625

Importance

Changes 2
Bugs 0 Features 0
Metric Value
c 2
b 0
f 0
dl 0
loc 8
ccs 3
cts 4
cp 0.75
rs 9.4285
cc 2
eloc 4
nc 2
nop 0
crap 2.0625
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