Lines 83.33% 5 / 6
Methods 50.00% 1 / 2
Classes 0.00% 0 / 1
Name Lines Methods CRAP
 __construct 100.00% 5 / 5 100.00% 1 / 1 3
 getPlatform 0.00% 0 / 1 0.00% 0 / 1 2
12final readonly class ActionConfig implements ExposureConfig
13{
14    /**
15     * @param list<ActionField> $fields
16     * @throws ExposureException
17     */
18    public function __construct(
19        public ?string $name = null,
20        public ?string $description = null,
21        #[ListOf(ActionField::class)]
22        public array $fields = [],
23    ) {
24        if ($name === '') {
25            throw ExposureException::configInvalid('The action name must not be empty; leave it null to use the key.');
26        }
27
28        $names = array_map(static fn(ActionField $field): string => $field->name, $fields);
29
30        if (\count(array_unique($names)) !== \count($names)) {
31            throw ExposureException::configInvalid('The action field names must be distinct.');
32        }
33    }
34
35    public function getPlatform(): ExposedPlatform
36    {
37        return ExposedPlatform::Action;
38    }
39}