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
AppSelection 100.00% 3 / 3 100.00% 3 / 3 4 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 admitsApp 100.00% 1 / 1 100.00% 1 / 1 2
 tracesApp 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\App;
6
7use Stewart\Contracts\App\AppId;
8use Stewart\Contracts\App\Collection\AppIdCollection;
9
10final readonly class AppSelection
11{
12    public function __construct(
13        public ?AppIdCollection $onlyIds = null,
14        public ?AppIdCollection $tracedIds = null,
15    ) {}
16
17    public function admitsApp(AppId $appId, bool $enabled): bool
18    {
19        return $this->onlyIds === null ? $enabled : $this->onlyIds->containsId($appId);
20    }
21
22    public function tracesApp(AppId $appId): bool
23    {
24        return $this->tracedIds?->containsId($appId) ?? false;
25    }
26}