| Total Complexity | 10 | 
| Total Lines | 70 | 
| Duplicated Lines | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php | ||
| 16 | final class UseStmtName | ||
| 17 | { | ||
| 18 | private Name $name; | ||
| 19 | |||
| 20 | public function __construct(Name $name) | ||
| 21 |     { | ||
| 22 | $this->name = $name; | ||
| 23 | } | ||
| 24 | |||
| 25 | public function contains(Name $resolvedName): bool | ||
| 26 |     { | ||
| 27 | return self::arrayStartsWith( | ||
| 28 | $resolvedName->parts, | ||
| 29 | $this->name->parts, | ||
| 30 | ); | ||
| 31 | } | ||
| 32 | |||
| 33 | /** | ||
| 34 | * @param string[] $array | ||
| 35 | * @param string[] $start | ||
| 36 | */ | ||
| 37 | private static function arrayStartsWith(array $array, array $start): bool | ||
| 38 |     { | ||
| 39 | $prefixLength = count($start); | ||
| 40 | |||
| 41 |         for ($index = 0; $index < $prefixLength; ++$index) { | ||
| 42 |             if (!isset($array[$index]) || $array[$index] !== $start[$index]) { | ||
| 43 | return false; | ||
| 44 | } | ||
| 45 | } | ||
| 46 | |||
| 47 | return true; | ||
| 48 | } | ||
| 49 | |||
| 50 | /** | ||
| 51 |      * @return array{string|null, Use_::TYPE_*} | ||
|  | |||
| 52 | */ | ||
| 53 | public function getUseStmtAliasAndType(): array | ||
| 86 | ]; | ||
| 87 | } | ||
| 88 | } | ||
| 89 |