| Conditions | 2 |
| Paths | 2 |
| Total Lines | 15 |
| Code Lines | 8 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 2 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 9 | 5 | public function getUseStatement(string $className, string $phpCode): string |
|
| 10 | { |
||
| 11 | 5 | if ($phpCode === '') { |
|
| 12 | 1 | return ''; |
|
| 13 | } |
||
| 14 | |||
| 15 | 4 | $needle = "{$className};"; |
|
| 16 | 4 | $lines = array_filter( |
|
| 17 | 4 | explode(PHP_EOL, $phpCode), |
|
| 18 | 4 | static fn (string $l) => str_contains($l, $needle) |
|
| 19 | ); |
||
| 20 | /** @psalm-suppress RedundantCast */ |
||
| 21 | 4 | $lineSplit = (array)explode(' ', (string)reset($lines)); |
|
| 22 | |||
| 23 | 4 | return rtrim($lineSplit[1] ?? '', ';'); |
|
| 24 | } |
||
| 26 |