Completed
Push — master ( 62c350...3dbd88 )
by Julián
01:27
created

AbstractEmptyCommand   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A reconstitute() 0 4 1
A getAllowedInterfaces() 0 4 1
1
<?php
2
3
/*
4
 * cqrs (https://github.com/phpgears/cqrs).
5
 * CQRS base.
6
 *
7
 * @license MIT
8
 * @link https://github.com/phpgears/cqrs
9
 * @author Julián Gutiérrez <[email protected]>
10
 */
11
12
declare(strict_types=1);
13
14
namespace Gears\CQRS;
15
16
use Gears\DTO\ScalarPayloadBehaviour;
17
use Gears\Immutability\ImmutabilityBehaviour;
18
19
/**
20
 * Abstract empty immutable event.
21
 */
22
abstract class AbstractEmptyCommand implements Command
23
{
24
    use ImmutabilityBehaviour, ScalarPayloadBehaviour {
25
        ScalarPayloadBehaviour::__call insteadof ImmutabilityBehaviour;
26
    }
27
28
    /**
29
     * AbstractEmptyCommand constructor.
30
     */
31
    final protected function __construct()
32
    {
33
        $this->checkImmutability();
34
    }
35
36
    /**
37
     * {@inheritdoc}
38
     *
39
     * @SuppressWarnings(PHPMD.UnusedFormalParameter)
40
     */
41
    final public static function reconstitute(array $parameters)
42
    {
43
        return new static();
44
    }
45
46
    /**
47
     * {@inheritdoc}
48
     *
49
     * @return string[]
50
     */
51
    final protected function getAllowedInterfaces(): array
52
    {
53
        return [Command::class];
54
    }
55
}
56