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

UnauthorizableCommandException::getCommand()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
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