Completed
Push — master ( b679bd...470c35 )
by Julián
02:07
created

ReceivedCommand::getCommandType()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * cqrs-async (https://github.com/phpgears/cqrs-async).
5
 * Async decorator for CQRS command bus.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/cqrs-async
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\CQRS\Async;
15
16
use Gears\CQRS\Async\Exception\ReceivedCommandException;
17
use Gears\CQRS\Command;
18
19
final class ReceivedCommand implements Command
20
{
21
    /**
22
     * @var Command
23
     */
24
    private $originalCommand;
25
26
    /**
27
     * ReceivedCommand constructor.
28
     *
29
     * @param Command $originalCommand
30
     */
31
    public function __construct(Command $originalCommand)
32
    {
33
        $this->originalCommand = $originalCommand;
34
    }
35
36
    /**
37
     * Get original command.
38
     *
39
     * @return Command
40
     */
41
    public function getOriginalCommand(): Command
42
    {
43
        return $this->originalCommand;
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @throws ReceivedCommandException
50
     */
51
    public function getCommandType(): string
52
    {
53
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     *
59
     * @throws ReceivedCommandException
60
     */
61
    public function has(string $parameter): bool
62
    {
63
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
64
    }
65
66
    /**
67
     * {@inheritdoc}
68
     *
69
     * @throws ReceivedCommandException
70
     *
71
     * @return mixed
72
     */
73
    public function get(string $parameter)
74
    {
75
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
76
    }
77
78
    /**
79
     * {@inheritdoc}
80
     *
81
     * @throws ReceivedCommandException
82
     *
83
     * @return array<string, mixed>
84
     */
85
    public function getPayload(): array
86
    {
87
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
88
    }
89
90
    /**
91
     * {@inheritdoc}
92
     *
93
     * @throws ReceivedCommandException
94
     */
95
    public static function reconstitute(array $parameters): void
96
    {
97
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
98
    }
99
}
100