| Total Complexity | 12 |
| Total Lines | 70 |
| Duplicated Lines | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 5 | trait InteractsWithSourceFiles |
||
| 6 | { |
||
| 7 | protected function findSource($stack) |
||
| 8 | { |
||
| 9 | $sources = []; |
||
| 10 | |||
| 11 | foreach ($stack as $index => $trace) { |
||
| 12 | $sources[] = $this->parseTrace($index, $trace); |
||
| 13 | } |
||
| 14 | |||
| 15 | return array_values(array_filter($sources)); |
||
| 16 | } |
||
| 17 | |||
| 18 | public function parseTrace($index, array $trace) |
||
| 36 | } |
||
| 37 | |||
| 38 | /** |
||
| 39 | * Check if the given file is to be excluded from analysis |
||
| 40 | * |
||
| 41 | * @param string $file |
||
| 42 | * @return bool |
||
| 43 | */ |
||
| 44 | protected function fileIsInExcludedPath($file) |
||
| 45 | { |
||
| 46 | $excludedPaths = [ |
||
| 47 | '/vendor/laravel/framework/src/Illuminate/Database', |
||
| 48 | '/vendor/laravel/framework/src/Illuminate/Events', |
||
| 49 | ]; |
||
| 50 | |||
| 51 | $normalizedPath = str_replace('\\', '/', $file); |
||
| 52 | |||
| 53 | foreach ($excludedPaths as $excludedPath) { |
||
| 54 | if (strpos($normalizedPath, $excludedPath) !== false) { |
||
| 55 | return true; |
||
| 56 | } |
||
| 57 | } |
||
| 58 | |||
| 59 | return false; |
||
| 60 | } |
||
| 61 | |||
| 62 | /** |
||
| 63 | * Shorten the path by removing the relative links and base dir |
||
| 64 | * |
||
| 65 | * @param string $path |
||
| 66 | * @return string |
||
| 67 | */ |
||
| 68 | protected function normalizeFilename($path): string |
||
| 75 | } |
||
| 76 | } |