File tree Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Expand file tree Collapse file tree 3 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -30,8 +30,8 @@ public function run(): void
3030 $ commandFactory = $ this ->commandFactory ;
3131 foreach ($ this ->flowSteps as $ step ) {
3232 $ currentCommand = $ commandFactory ->createCommand ($ step );
33- $ nextCommand = $ currentCommand ->execute ($ this ->initCommand );
34- $ this ->initCommand = $ nextCommand ;
33+ $ this -> nextCommand = $ currentCommand ->execute ($ this ->initCommand );
34+ $ this ->initCommand = $ this -> nextCommand ;
3535 }
3636 }
3737}
Original file line number Diff line number Diff line change 99use Differ \DisplayCommand ;
1010use Differ \Formatters ;
1111
12- function genDiff (string $ pathToFile1 , string $ pathToFile2 , string $ format = 'stylish ' )
13- {
12+ function genDiff (
13+ string $ pathToFile1 ,
14+ string $ pathToFile2 ,
15+ string $ format = 'stylish '
16+ ): string {
1417 $ commandFactory = new CommandFactory (
1518 new \Docopt (),
1619 new FileReader (),
Original file line number Diff line number Diff line change @@ -17,21 +17,20 @@ class Formatters implements CommandFactoryInterface
1717
1818 public function createCommand (string $ commandKey ): CommandInterface
1919 {
20- $ requestedCommand = null ;
2120 switch ($ commandKey ) {
2221 case self ::FORMAT_KEYS ["stylish " ]:
23- $ requestedCommand = new StylishCommand ();
22+ $ this -> formatCommand = new StylishCommand ();
2423 break ;
2524 case self ::FORMAT_KEYS ["plain " ]:
26- $ requestedCommand = new PlainCommand ();
25+ $ this -> formatCommand = new PlainCommand ();
2726 break ;
2827 case self ::FORMAT_KEYS ["json " ]:
29- $ requestedCommand = new JSONCommand ();
28+ $ this -> formatCommand = new JSONCommand ();
3029 break ;
3130 default :
3231 return throw new DifferException ("input error: unknown output format \n" );
3332 }
3433
35- return $ requestedCommand ;
34+ return $ this -> formatCommand ;
3635 }
3736}
You can’t perform that action at this time.
0 commit comments