| Total Complexity | 6 |
| Total Lines | 21 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php declare(strict_types=1); |
||
| 10 | final class UseStatements |
||
| 11 | { |
||
| 12 | /** @param UseStatement[] $useStatements */ |
||
| 13 | public function __construct(private readonly array $useStatements) |
||
|
|
|||
| 14 | { |
||
| 15 | } |
||
| 16 | |||
| 17 | public function fullyQualifiedNameFor(Name $name): string |
||
| 18 | { |
||
| 19 | foreach ($this->useStatements as $useStatement) { |
||
| 20 | if ($useStatement->endsWith($name)) { |
||
| 21 | return $useStatement->fullyQualifiedName($name); |
||
| 22 | } |
||
| 23 | if ($useStatement->includes($name)) { |
||
| 24 | return $useStatement->merge($name); |
||
| 25 | } |
||
| 26 | if ($useStatement->isAliasedAs($name)) { |
||
| 27 | return $useStatement->fullyQualifiedName($name); |
||
| 28 | } |
||
| 29 | } |
||
| 30 | return $name->fullName(); |
||
| 31 | } |
||
| 33 |