Total Complexity | 6 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
9 | class Result implements Response |
||
10 | { |
||
11 | public const NAME = 'domain.create_board.response'; |
||
12 | |||
13 | private const SUCCESS_KEY = 'success'; |
||
14 | |||
15 | /** @var array */ |
||
16 | private $payload; |
||
17 | |||
18 | private function __construct(array $data) |
||
19 | { |
||
20 | $this->payload = $data; |
||
21 | } |
||
22 | |||
23 | public static function ok(Board $board): self |
||
24 | { |
||
25 | return new self( |
||
26 | [ |
||
27 | self::SUCCESS_KEY => true, |
||
28 | 'board_uuid' => $board->getUuid()->getValue() |
||
29 | ] |
||
30 | ); |
||
31 | } |
||
32 | |||
33 | public static function fail(string $reason): self |
||
34 | { |
||
35 | return new self( |
||
36 | [ |
||
37 | self::SUCCESS_KEY => false, |
||
38 | 'error' => $reason |
||
39 | ] |
||
40 | ); |
||
41 | } |
||
42 | |||
43 | public function isSuccess(): bool |
||
46 | } |
||
47 | |||
48 | public function getPayload(): array |
||
49 | { |
||
51 | } |
||
52 | |||
53 | public function getName(): Name |
||
58 |