File tree Expand file tree Collapse file tree 2 files changed +13
-12
lines changed
Expand file tree Collapse file tree 2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,17 @@ class Preventer
66{
77 private $ strategy ;
88
9- public function __construct (Strategy $ strategy )
9+ public function __construct ($ strategy )
1010 {
11- $ this ->strategy = $ strategy ;
11+ switch ($ strategy ) {
12+ case 'database ' :
13+ $ this ->strategy = new DatabaseStrategy ();
14+ break ;
15+
16+ case 'file ' :
17+ default :
18+ $ this ->strategy = new FileStrategy ();
19+ break ;
20+ }
1221 }
1322}
Original file line number Diff line number Diff line change 22
33namespace Illuminated \Console ;
44
5+ use Illuminated \Console \Overlapping \Preventer ;
56use Symfony \Component \Console \Input \InputInterface ;
67use Symfony \Component \Console \Output \OutputInterface ;
78
@@ -10,16 +11,7 @@ trait WithoutOverlapping
1011 protected function execute (InputInterface $ input , OutputInterface $ output )
1112 {
1213 $ strategy = $ this ->getOverlappingStrategy ();
13- switch ($ strategy ) {
14- case 'database ' :
15- //
16- break ;
17-
18- case 'file ' :
19- default :
20- //
21- break ;
22- }
14+ $ preventer = new Preventer ($ strategy );
2315
2416 return parent ::execute ($ input , $ output );
2517 }
You can’t perform that action at this time.
0 commit comments