ExchangeArgument::getArgumentName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 1
1
<?php
2
3
namespace mcorten87\rabbitmq_api\objects;
4
5
class ExchangeArgument extends BaseObject
6
{
7
    /**
8
     * @var integer
9
     * If messages to this exchange cannot otherwise be routed, send them to the alternate exchange named here.
10
     */
11
    const ALTERNATE_EXCHAGE = 'alternate-exchange';
12
13
14
    private $argumentName;
15
16
    /**
17
     * @return String
18
     */
19 6
    public function getArgumentName()
20
    {
21 6
        return $this->argumentName;
22
    }
23
24 6
    public function __construct(String $argument, string $value)
25
    {
26 6
        $this->argumentName = $argument;
27
28 6
        parent::__construct($value);
29 3
    }
30
31 6
    public function validate($value) : bool
32
    {
33 6
        if (empty($this->getArgumentName()) || empty($value)) {
34 2
            return false;
35
        }
36
37
38 4
        switch ($this->argumentName) {
39 4
            case self::ALTERNATE_EXCHAGE:
40 3
                return true;
41
42
            default:
43 1
                return false;
44
        }
45
    }
46
}
47