Lines 100.00% 3 / 3
Functions and Methods 100.00% 3 / 3
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
ComponentCommandAnswer 100.00% 3 / 3 100.00% 3 / 3 3 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 accept 100.00% 1 / 1 100.00% 1 / 1 1
 reject 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Client\Component;
6
7final readonly class ComponentCommandAnswer
8{
9    private function __construct(
10        public string $commandId,
11        public bool $accepted,
12        public ?string $message,
13    ) {}
14
15    public static function accept(string $commandId): self
16    {
17        return new self($commandId, true, null);
18    }
19
20    public static function reject(string $commandId, string $message): self
21    {
22        return new self($commandId, false, $message);
23    }
24}