| Conditions | 5 |
| Paths | 5 |
| Total Lines | 21 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 31 | public function getCredits($dir) |
||
| 32 | { |
||
| 33 | $credits = []; |
||
| 34 | |||
| 35 | /** @var \SplFileInfo $file */ |
||
| 36 | foreach (new RecursiveDirectoryRegexIterator($dir, '/license.?.*$/i') as $file) { |
||
| 37 | foreach (file($file->getPathname()) as $line) { |
||
| 38 | if (0 === strpos($line, 'Copyright (c)')) { |
||
| 39 | |||
| 40 | $vendor = basename(dirname($file->getPath())); |
||
| 41 | $package = basename($file->getPath()); |
||
| 42 | $name = ($vendor === 'vendor') ? $package : "$vendor/$package"; |
||
| 43 | |||
| 44 | $credits[$name] = [$name, $line]; |
||
| 45 | } |
||
| 46 | } |
||
| 47 | } |
||
| 48 | |||
| 49 | asort($credits); |
||
| 50 | return $credits; |
||
| 51 | } |
||
| 52 | } |
||
| 53 |