@@ -33,7 +33,8 @@ protected function configure(): void
3333 ->setDescription ('Generate a codemap of PHP code ' )
3434 ->addArgument ('paths ' , InputArgument::IS_ARRAY | InputArgument::OPTIONAL , 'Paths to scan ' , [])
3535 ->addOption ('output ' , 'o ' , InputOption::VALUE_REQUIRED , 'Output file path (use "-" for stdout) ' , 'codemap.txt ' )
36- ->addOption ('php-version ' , null , InputOption::VALUE_REQUIRED , 'PHP version to use for parsing (e.g., "8.3") ' );
36+ ->addOption ('php-version ' , null , InputOption::VALUE_REQUIRED , 'PHP version to use for parsing (e.g., "8.3") ' )
37+ ->addOption ('visibility ' , null , InputOption::VALUE_REQUIRED , 'Comma-separated property visibility levels (e.g., "public,protected") ' );
3738 }
3839
3940 #[Override]
@@ -61,9 +62,19 @@ protected function handle(): int
6162 $ phpVersion = $ this ->getPhpVersion ($ config );
6263
6364 /* @phpstan-ignore-next-line */
64- $ codemapResults = $ this ->generateCodemap ($ scanPaths , $ phpVersion );
65+ $ codemapResults = $ this ->generateCodemap ($ scanPaths , $ phpVersion, $ config );
6566
66- $ formatter = new TextCodemapFormatter ;
67+ // Determine visibility levels
68+ $ propertyVisibilityLevels = $ config ->getPropertyVisibilityLevels ();
69+ $ methodVisibilityLevels = $ config ->getMethodVisibilityLevels (); // Keep default for now
70+
71+ $ visibilityOption = $ this ->option ('visibility ' );
72+ if (is_string ($ visibilityOption ) && $ visibilityOption !== '' ) {
73+ $ propertyVisibilityLevels = array_map ('trim ' , explode (', ' , strtolower ($ visibilityOption )));
74+ // TODO: Add validation for allowed values ('public', 'protected', 'private')
75+ }
76+
77+ $ formatter = new TextCodemapFormatter ($ propertyVisibilityLevels , $ methodVisibilityLevels );
6778 $ formattedOutput = $ formatter ->format ($ codemapResults );
6879
6980 $ outputFile = $ this ->option ('output ' );
@@ -158,9 +169,10 @@ private function getPhpVersion(CodemapConfig $config): ?PhpVersion
158169 * @param string[] $scanPaths
159170 * @return array<string, CodemapFileDto>
160171 */
161- private function generateCodemap (array $ scanPaths , ?PhpVersion $ phpVersion ): array
172+ private function generateCodemap (array $ scanPaths , ?PhpVersion $ phpVersion, CodemapConfig $ config ): array
162173 {
163- $ codemapGenerator = new CodemapGenerator ;
174+ // Pass config to generator for exclusion paths
175+ $ codemapGenerator = new CodemapGenerator ($ config );
164176 if ($ phpVersion instanceof PhpVersion) {
165177 $ codemapGenerator ->setPhpParserVersion ($ phpVersion ->toParserPhpVersion ());
166178 }
0 commit comments