Lines 100.00% 2 / 2
Functions and Methods 100.00% 2 / 2
Classes and Traits 100.00% 1 / 1
Name Lines Functions and Methods CRAP Classes and Traits
ExposedStateChange 100.00% 2 / 2 100.00% 2 / 2 2 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 withLaterChange 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Contracts\Exposure;
6
7// A null field leaves that part of the entity as it is; an ExposedState holding null makes the state unknown.
8final readonly class ExposedStateChange
9{
10    /** @param array<string, mixed>|null $attributes */
11    public function __construct(
12        public ?ExposedState $state = null,
13        public ?array $attributes = null,
14        public ?bool $available = null,
15    ) {}
16
17    public function withLaterChange(self $later): self
18    {
19        return new self($later->state ?? $this->state, $later->attributes ?? $this->attributes, $later->available ?? $this->available);
20    }
21}