humbug /
box
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | use function Humbug\PhpScoper\json_decode; |
||
| 6 | use function KevinGH\Box\FileSystem\file_contents; |
||
| 7 | use function KevinGH\Box\parallel_map; |
||
| 8 | |||
| 9 | require __DIR__.'/vendor/autoload.php'; |
||
| 10 | |||
| 11 | $config = KevinGH\Box\Configuration\Configuration::create( |
||
| 12 | __DIR__.'/requirement-checker/box.json.dist', |
||
| 13 | json_decode( |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 14 | file_get_contents(__DIR__.'/requirement-checker/box.json.dist') |
||
| 15 | ) |
||
| 16 | ); |
||
| 17 | |||
| 18 | $mapFile = $config->getFileMapper(); |
||
| 19 | $compactors = $config->getCompactors(); |
||
| 20 | $cwd = getcwd(); |
||
| 21 | |||
| 22 | $processFile = static function (string $file) use ($cwd, $mapFile, $compactors): array { |
||
| 23 | chdir($cwd); |
||
| 24 | |||
| 25 | // Keep the fully qualified call here since this function may be executed without the right autoloading |
||
| 26 | // mechanism |
||
| 27 | \KevinGH\Box\register_aliases(); |
||
| 28 | if (true === \KevinGH\Box\is_parallel_processing_enabled()) { |
||
| 29 | \KevinGH\Box\register_error_handler(); |
||
| 30 | } |
||
| 31 | |||
| 32 | $contents = file_contents($file); |
||
| 33 | |||
| 34 | $local = $mapFile($file); |
||
| 35 | |||
| 36 | $processedContents = $compactors->compact($local, $contents); |
||
| 37 | |||
| 38 | return [$local, $processedContents, $compactors->getScoperWhitelist()]; |
||
| 39 | }; |
||
| 40 | |||
| 41 | $files = [__DIR__.'/requirement-checker/composer.json']; |
||
| 42 | |||
| 43 | parallel_map($files, $processFile); |
||
| 44 |