1: | <?php declare(strict_types = 1); |
2: | |
3: | namespace PHPStan\Node; |
4: | |
5: | use PhpParser\Node; |
6: | use PhpParser\NodeAbstract; |
7: | use PHPStan\Collectors\CollectedData; |
8: | use PHPStan\Collectors\Collector; |
9: | |
10: | |
11: | |
12: | |
13: | |
14: | final class CollectedDataNode extends NodeAbstract implements VirtualNode |
15: | { |
16: | |
17: | |
18: | |
19: | |
20: | public function __construct(private array $collectedData, private bool $onlyFiles) |
21: | { |
22: | parent::__construct([]); |
23: | } |
24: | |
25: | |
26: | |
27: | |
28: | |
29: | |
30: | |
31: | public function get(string $collectorType): array |
32: | { |
33: | $result = []; |
34: | foreach ($this->collectedData as $filePath => $collectedDataPerCollector) { |
35: | if (!isset($collectedDataPerCollector[$collectorType])) { |
36: | continue; |
37: | } |
38: | |
39: | foreach ($collectedDataPerCollector[$collectorType] as $rawData) { |
40: | $result[$filePath][] = $rawData; |
41: | } |
42: | } |
43: | |
44: | return $result; |
45: | } |
46: | |
47: | |
48: | |
49: | |
50: | |
51: | |
52: | public function isOnlyFilesAnalysis(): bool |
53: | { |
54: | return $this->onlyFiles; |
55: | } |
56: | |
57: | public function getType(): string |
58: | { |
59: | return 'PHPStan_Node_CollectedDataNode'; |
60: | } |
61: | |
62: | |
63: | |
64: | |
65: | public function getSubNodeNames(): array |
66: | { |
67: | return []; |
68: | } |
69: | |
70: | } |
71: | |