Lines 100.00% 6 / 6
Methods 100.00% 3 / 3
Classes 100.00% 1 / 1
Covered by tests of size
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 toArray 100.00% 4 / 4 100.00% 1 / 1 1
 fromArray 100.00% 1 / 1 100.00% 1 / 1 1
22final readonly class IndexFaqMessage implements QueueMessageInterface
23{
24    public function __construct(
25        public int $faqId,
26        public string $language = '',
27    ) {
28    }
29
30    public function toArray(): array
31    {
32        return [
33            'faqId' => $this->faqId,
34            'language' => $this->language,
35        ];
36    }
37
38    public static function fromArray(array $payload): self
39    {
40        return new self(faqId: (int) ($payload['faqId'] ?? 0), language: (string) ($payload['language'] ?? ''));
41    }
42}