Completed
Branch master (aafddc)
by Julián
01:26
created

ReceivedCommand::getPayload()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 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 has(string $parameter): bool
52
    {
53
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
54
    }
55
56
    /**
57
     * {@inheritdoc}
58
     *
59
     * @throws ReceivedCommandException
60
     *
61
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use NoType.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
62
     */
63
    public function get(string $parameter)
64
    {
65
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
66
    }
67
68
    /**
69
     * {@inheritdoc}
70
     *
71
     * @throws ReceivedCommandException
72
     *
73
     * @return array<string, mixed>
0 ignored issues
show
Documentation introduced by
The doc-type array<string, could not be parsed: Expected ">" at position 5, but found "end of type". (view supported doc-types)

This check marks PHPDoc comments that could not be parsed by our parser. To see which comment annotations we can parse, please refer to our documentation on supported doc-types.

Loading history...
74
     */
75
    public function getPayload(): array
76
    {
77
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
78
    }
79
80
    /**
81
     * {@inheritdoc}
82
     *
83
     * @throws ReceivedCommandException
84
     */
85
    public static function reconstitute(array $parameters): void
86
    {
87
        throw new ReceivedCommandException(\sprintf('Method %s should not be called ', __METHOD__));
88
    }
89
}
90