File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 99
1010final class Command
1111{
12+ private const VERSION = '0.0.3 ' ;
13+
1214 /**
1315 * @param list<string> $argv
1416 */
@@ -19,14 +21,26 @@ public function run(array $argv): void
1921 return ;
2022 }
2123
24+ $ option = $ argv [1 ];
25+
26+ if ($ option === '--help ' ) {
27+ $ this ->printHelp ();
28+ return ;
29+ }
30+
31+ if ($ option === '--version ' ) {
32+ $ this ->printVersion ();
33+ return ;
34+ }
35+
2236 $ filePath = $ argv [1 ];
2337 if (!file_exists ($ filePath )) {
2438 echo "File not found: $ filePath \n" ;
2539 return ;
2640 }
2741
2842 $ parser = new VariableParser ();
29- $ content =file_get_contents ($ filePath );
43+ $ content = file_get_contents ($ filePath );
3044 if ($ content === false ) {
3145 echo "Failed to read file: $ filePath \n" ;
3246 return ;
@@ -44,4 +58,9 @@ private function printHelp(): void
4458 echo " --help Display help information \n" ;
4559 echo " --version Show the version of the tool \n" ;
4660 }
61+
62+ private function printVersion (): void
63+ {
64+ echo "PHP Variable Hard Usage Analyzer, version " . self ::VERSION . "\n" ;
65+ }
4766}
You can’t perform that action at this time.
0 commit comments