Passed
Push — master ( eac84f...04da79 )
by Tomasz
01:29
created

Command   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 38
rs 10
c 0
b 0
f 0
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getName() 0 3 1
A getNodeName() 0 3 1
A __construct() 0 5 1
A getData() 0 3 1
A getPayload() 0 5 1
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
namespace Aggrego\Neo4jIntegration\Api\Command\CreateNode;
13
14
use Aggrego\CommandConsumer\Command as CommandConsumer;
15
use Aggrego\CommandConsumer\Name;
16
use Assert\Assertion;
17
18
class Command implements CommandConsumer
19
{
20
    private const NAME = 'neo4j_integration.create_node';
21
22
    /** @var string */
23
    private $nodeName;
24
25
    /** @var array */
26
    private $data;
27
28
    public function __construct(string $nodeName, array $data)
29
    {
30
        Assertion::notEmpty($nodeName);
31
        $this->nodeName = $nodeName;
32
        $this->data = $data;
33
    }
34
35
    public function getName(): Name
36
    {
37
        return new Name(self::NAME);
38
    }
39
40
    public function getPayload(): array
41
    {
42
        return [
43
            'node_name' => $this->nodeName,
44
            'data' => $this->data
45
        ];
46
    }
47
48
    public function getNodeName(): string
49
    {
50
        return $this->nodeName;
51
    }
52
53
    public function getData(): array
54
    {
55
        return $this->data;
56
    }
57
}
58