Lines 100.00% 4 / 4
Methods 100.00% 4 / 4
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 isHandle 100.00% 1 / 1 100.00% 1 / 1 2
 findDomain 100.00% 1 / 1 100.00% 1 / 1 2
 isGeneratedEntityId 100.00% 1 / 1 100.00% 1 / 1 2
13final readonly class GeneratedHandles
14{
15    public function __construct(private ReflectionProvider $reflection) {}
16
17    public function isHandle(string $class): bool
18    {
19        return $this->reflection->hasClass($class) && $this->reflection->getClass($class)->implementsInterface(TypedEntity::class);
20    }
21
22    public function findDomain(string $class): ?string
23    {
24        return is_a($class, TypedEntity::class, true) ? $class::getDomain() : null;
25    }
26
27    public function isGeneratedEntityId(string $class, string $entityId): bool
28    {
29        return is_a($class, TypedEntity::class, true) && $class::isGeneratedEntityId(new EntityId($entityId));
30    }
31}