1 | <?php |
||
2 | |||
3 | declare(strict_types=1); |
||
4 | |||
5 | /* |
||
6 | * This file is part of the box project. |
||
7 | * |
||
8 | * (c) Kevin Herrera <[email protected]> |
||
9 | * Théo Fidry <[email protected]> |
||
10 | * |
||
11 | * This source file is subject to the MIT license that is bundled |
||
12 | * with this source code in the file LICENSE. |
||
13 | */ |
||
14 | |||
15 | namespace KevinGH\Box\Parallelization; |
||
16 | |||
17 | use Humbug\PhpScoper\Symbol\SymbolsRegistry; |
||
18 | use function array_merge; |
||
19 | |||
20 | /** |
||
21 | * @private |
||
22 | */ |
||
23 | final readonly class TaskResult |
||
0 ignored issues
–
show
Bug
introduced
by
![]() |
|||
24 | { |
||
25 | /** |
||
26 | * @param self[] $results |
||
27 | */ |
||
28 | public static function aggregate(array $results): self |
||
29 | { |
||
30 | $filesWithContents = []; |
||
31 | $symbolsRegistries = []; |
||
32 | |||
33 | foreach ($results as $result) { |
||
34 | $filesWithContents[] = $result->filesWithContents; |
||
35 | $symbolsRegistries[] = $result->symbolsRegistry; |
||
36 | } |
||
37 | |||
38 | return new self( |
||
39 | array_merge(...$filesWithContents), |
||
40 | SymbolsRegistry::createFromRegistries($symbolsRegistries), |
||
41 | ); |
||
42 | } |
||
43 | |||
44 | /** |
||
45 | * @param list<array{string, string}> $filesWithContents |
||
46 | */ |
||
47 | public function __construct( |
||
48 | public array $filesWithContents, |
||
49 | public SymbolsRegistry $symbolsRegistry, |
||
50 | ) { |
||
51 | } |
||
52 | } |
||
53 |