ExchangeArgument   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 42
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getArgumentName() 0 4 1
A __construct() 0 6 1
A validate() 0 15 4
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