Completed
Pull Request — master (#326)
by Luc
04:24
created

UnauthorizableCommandException   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 1
dl 0
loc 42
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
A getUserId() 0 4 1
A getCommand() 0 4 1
1
<?php
2
3
namespace CultuurNet\UDB3\CommandHandling;
4
5
use ValueObjects\StringLiteral\StringLiteral;
6
7
class UnauthorizableCommandException extends \Exception
8
{
9
    /**
10
     * @var StringLiteral
11
     */
12
    private $userId;
13
14
    /**
15
     * @var mixed
16
     */
17
    private $command;
18
19
    /**
20
     * @param StringLiteral $userId
21
     * @param mixed $command
22
     */
23
    public function __construct(StringLiteral $userId, $command)
24
    {
25
        parent::__construct('User with id: ' . $userId->toNative() .
26
            ' failed to execute command: ' . get_class($command) .
27
            ' because it is not authorizable.');
28
29
        $this->userId = $userId;
30
        $this->command = $command;
31
    }
32
33
    /**
34
     * @return StringLiteral
35
     */
36
    public function getUserId()
37
    {
38
        return $this->userId;
39
    }
40
41
    /**
42
     * @return mixed
43
     */
44
    public function getCommand()
45
    {
46
        return $this->command;
47
    }
48
}
49