Lines 100.00% 4 / 4
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 readCurrentStates 100.00% 3 / 3 100.00% 1 / 1 2
13final readonly class CachedStateReader implements CurrentStateReader
14{
15    public function __construct(
16        private StateCache $states,
17        private RegistryCache $registry,
18        private Selector|EntityFilter $match,
19    ) {}
20
21    public function readCurrentStates(): EntityStateCollection
22    {
23        return $this->match instanceof EntityFilter
24            ? $this->states->getAllStates()->filterByEntityFilter($this->match, $this->registry)
25            : $this->states->filterBySelector($this->match);
26    }
27}