44
55namespace Boundwize \StructArmed \Analyser \Parallel ;
66
7- use Boundwize \StructArmed \Analyser \AnalyserOptions ;
87use Boundwize \StructArmed \Analyser \ClassNode ;
9- use Boundwize \StructArmed \Analyser \ClassNodeExtractor ;
10- use Boundwize \StructArmed \LayerResolver \ChainLayerResolver ;
118use Boundwize \StructArmed \Progress \ProgressHandlerInterface ;
129use RuntimeException ;
1310
2320use function feof ;
2421use function file_put_contents ;
2522use function fread ;
26- use function function_exists ;
2723use function is_array ;
2824use function is_dir ;
2925use function is_resource ;
4541
4642final readonly class ParallelClassNodeExtractor
4743{
48- private AnalyserOptions $ analyserOptions ;
49-
5044 /**
5145 * @param array<string, string|list<string>> $layers
5246 * @param array<string, array{pattern: string, excludePattern: string|null}> $layerPatterns
@@ -58,7 +52,6 @@ public function __construct(
5852 private int $ workerCount ,
5953 private ?string $ cacheDirectory = null ,
6054 ) {
61- $ this ->analyserOptions = AnalyserOptions::parallel ($ this ->workerCount );
6255 }
6356
6457 /**
@@ -67,8 +60,8 @@ public function __construct(
6760 */
6861 public function extract (array $ files , ?ProgressHandlerInterface $ progressHandler = null ): array
6962 {
70- if ($ files === [] || ! $ this -> analyserOptions -> isParallel () || ! function_exists ( ' proc_open ' ) ) {
71- return ( new ClassNodeExtractor ( $ this -> layerResolver ()))-> extract ( $ files , $ progressHandler ) ;
63+ if ($ files === []) {
64+ return [] ;
7265 }
7366
7467 $ workerCount = min ($ this ->workerCount , count ($ files ));
@@ -257,11 +250,6 @@ private function temporaryFile(): string
257250 return $ file ;
258251 }
259252
260- private function layerResolver (): ChainLayerResolver
261- {
262- return ChainLayerResolver::fromLayerConfig ($ this ->layers , $ this ->basePath , $ this ->layerPatterns );
263- }
264-
265253 /**
266254 * @param list<string> $files
267255 */
0 commit comments