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
AppSelection 100.00% 2 / 2 100.00% 2 / 2 3 100.00% 1 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 admitsApp 100.00% 1 / 1 100.00% 1 / 1 2
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(public ?AppIdCollection $onlyIds = null) {}
13
14    public function admitsApp(AppId $appId, bool $enabled): bool
15    {
16        return $this->onlyIds === null ? $enabled : $this->onlyIds->containsId($appId);
17    }
18}