@@ -7,12 +7,9 @@ class ConsoleApp
77 private string $ docopt ;
88 private array $ commandTypeList ;
99 private $ currentCommand ;
10+ private array $ cliData ;
11+ private array $ filesContent ;
1012 private CommandFactoryInterface $ commandFactory ;
11- private CommandLineParserInterface $ commandLineParser ;
12- private CommandInterface $ filesDiffCommand ;
13- private CommandInterface $ displayCommand ;
14- private object $ cliData ;
15- private object $ filesContent ;
1613
1714 public function __construct ()
1815 {
@@ -46,37 +43,16 @@ public function run(): void
4643 $ this ->cliData = $ this ->currentCommand ->execute ();
4744 break ;
4845 case "difference " :
49- $ this ->filesContent = $ this -> currentCommand ->setFileReader (new FileReader ())
50- ->execute ($ this ->cliData );
46+ $ this ->currentCommand ->setFileReader (new FileReader ());
47+ $ this -> filesContent = $ this -> currentCommand ->execute ($ this ->cliData );
5148 break ;
5249 case "show " :
53- $ this ->currentCommand ->execute ($ this ->filesContent )
54- ->showDiffsToConsole ();
50+ $ this ->currentCommand ->execute ($ this ->filesContent );
51+ $ this -> currentCommand ->showDiffsToConsole ();
5552 break ;
5653 default :
5754 throw new \Exception ('unknown command type ' );
5855 }
5956 }
60- /*
61- if ($this->commandLineParser = $this->commandFactory->getCommand("parse")) {
62- $this->cliData = $this->commandLineParser->execute();
63- } else {
64- throw new \Exception("can't create command line parser");
65- }
66-
67- if ($this->filesDiffCommand = $this->commandFactory->getCommand("difference")) {
68- $this->filesContent = $this->filesDiffCommand->setFileReader(new FileReader())
69- ->execute($this->cliData);
70- } else {
71- throw new \Exception("can't create files difference command");
72- }
73-
74- if ($this->displayCommand = $this->commandFactory->getCommand("show")) {
75- $this->displayCommand->execute($this->filesContent)
76- ->showDiffsToConsole();
77- } else {
78- throw new \Exception("can't create display command");
79- }
80- */
8157 }
8258}
0 commit comments