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