Passed
Push — master ( 5b1507...1f04af )
by Tomasz
01:43
created

Command::getName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
/**
3
 *
4
 * This file is part of the Aggrego.
5
 * (c) Tomasz Kunicki <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 */
11
12
declare(strict_types = 1);
13
14
namespace Aggrego\Domain\Api\Command\CreateBoard;
15
16
use Aggrego\CommandConsumer\Command as ConsumerCommand;
17
use Aggrego\CommandConsumer\Name;
18
use Aggrego\Domain\Board\Key;
19
use Aggrego\Domain\Profile\Profile;
20
21
class Command implements ConsumerCommand
22
{
23
    public const NAME = 'domain.create_board';
24
25
    /** @var Key */
26
    private $key;
27
28
    /** @var Profile */
29
    private $profile;
30
31
    public function __construct(array $key, string $profileName, string $versionNumber)
32
    {
33
        $this->key = new Key($key);
34
        $this->profile = Profile::createFromParts($profileName, $versionNumber);
35
    }
36
37
    public function getKey(): Key
38
    {
39
        return $this->key;
40
    }
41
42
    public function getProfile(): Profile
43
    {
44
        return $this->profile;
45
    }
46
47
    public function getName(): Name
48
    {
49
        return new Name(self::NAME);
50
    }
51
52
    public function getPayload(): array
53
    {
54
        return [
55
            'key' => $this->key->getValue(),
56
            'profile' => (string)$this->profile,
57
        ];
58
    }
59
}
60