Total Complexity | 6 |
Total Lines | 46 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
17 | class Response implements CommandConsumerResponse |
||
18 | { |
||
19 | private const NAME = 'neo4j_integration.create_node.response'; |
||
20 | |||
21 | private const SUCCESS_KEY = 'success'; |
||
22 | |||
23 | /** @var array */ |
||
24 | private $payload; |
||
25 | |||
26 | private function __construct(array $data) |
||
27 | { |
||
28 | $this->payload = $data; |
||
29 | } |
||
30 | |||
31 | public function getName(): Name |
||
34 | } |
||
35 | |||
36 | public static function ok(): self |
||
37 | { |
||
38 | return new self( |
||
39 | [ |
||
40 | self::SUCCESS_KEY => true |
||
41 | ] |
||
42 | ); |
||
43 | } |
||
44 | |||
45 | public static function fail(string $reason): self |
||
51 | ] |
||
52 | ); |
||
53 | } |
||
54 | |||
55 | public function isSuccess(): bool |
||
56 | { |
||
57 | return $this->payload[self::SUCCESS_KEY]; |
||
58 | } |
||
59 | |||
60 | public function getPayload(): array |
||
63 | } |
||
64 | } |
||
65 |