Total Complexity | 6 |
Total Lines | 38 |
Duplicated Lines | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
9 | class LightSwitchWasFlipped implements SerializablePayload |
||
10 | { |
||
11 | const ON = true; |
||
12 | const OFF = false; |
||
13 | |||
14 | /** |
||
15 | * @var bool |
||
16 | */ |
||
17 | private $state; |
||
18 | |||
19 | private function __construct(bool $state) |
||
20 | { |
||
21 | $this->state = $state; |
||
22 | } |
||
23 | |||
24 | public function state(): bool |
||
25 | { |
||
26 | return $this->state; |
||
27 | } |
||
28 | |||
29 | public static function on(): LightSwitchWasFlipped |
||
30 | { |
||
31 | return new static(self::ON); |
||
32 | } |
||
33 | |||
34 | public static function off(): LightSwitchWasFlipped |
||
37 | } |
||
38 | |||
39 | public function toPayload(): array |
||
42 | } |
||
43 | |||
44 | public static function fromPayload(array $payload): SerializablePayload |
||
47 | } |
||
48 | } |
||
49 |