| Conditions | 7 |
| Paths | 5 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 13 |
| CRAP Score | 7 |
| Changes | 0 | ||
| 1 | <?php |
||
| 44 | 1 | public function getFullClassName(string $class): ?string { |
|
| 45 | 1 | if ($class[0] === '\\') { |
|
| 46 | 1 | return $class; |
|
| 47 | } |
||
| 48 | |||
| 49 | 1 | $classParts = explode('\\', $class); |
|
| 50 | 1 | $passedNamespace = array_shift($classParts); |
|
| 51 | |||
| 52 | /** @var UseStatement $useStatement */ |
||
| 53 | 1 | foreach ($this as $useStatement) { |
|
| 54 | 1 | $useParts = explode('\\', $useStatement->getUse()); |
|
| 55 | 1 | $definedNamespace = array_pop($useParts); |
|
| 56 | |||
| 57 | 1 | if ($definedNamespace === $class || $useStatement->getAlias() === $class) { |
|
| 58 | 1 | return $useStatement->getUse(); |
|
| 59 | 1 | } elseif ($definedNamespace === $passedNamespace || $useStatement->getAlias() === $passedNamespace) { |
|
| 60 | 1 | return $useStatement->getUse() . '\\' . implode('\\', $classParts); |
|
| 61 | } |
||
| 62 | } |
||
| 63 | |||
| 64 | 1 | return null; |
|
| 65 | } |
||
| 66 | |||
| 67 | } |