| Conditions | 7 | 
| Paths | 5 | 
| Total Lines | 26 | 
| Code Lines | 14 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 27 | public function resolveRole(object|string $entity): string  | 
            ||
| 28 |     { | 
            ||
| 29 |         if (\is_object($entity)) { | 
            ||
| 30 | $node = $this->heap->get($entity);  | 
            ||
| 31 |             if ($node !== null) { | 
            ||
| 32 | return $node->getRole();  | 
            ||
| 33 | }  | 
            ||
| 34 | |||
| 35 | /** @var class-string $class */  | 
            ||
| 36 | $class = $entity::class;  | 
            ||
| 37 |             if (!$this->schema->defines($class)) { | 
            ||
| 38 | $parentClass = \get_parent_class($entity);  | 
            ||
| 39 | |||
| 40 | if ($parentClass === false  | 
            ||
| 41 | || !$entity instanceof EntityProxyInterface  | 
            ||
| 42 | || !$this->schema->defines($parentClass)  | 
            ||
| 43 |                 ) { | 
            ||
| 44 |                     throw new ORMException("Unable to resolve role of `$class`."); | 
            ||
| 45 | }  | 
            ||
| 46 | $class = $parentClass;  | 
            ||
| 47 | }  | 
            ||
| 48 | |||
| 49 | $entity = $class;  | 
            ||
| 50 | }  | 
            ||
| 51 | |||
| 52 |         return $this->schema->resolveAlias($entity) ?? throw new ORMException("Unable to resolve role `$entity`."); | 
            ||
| 53 | }  | 
            ||
| 55 |