1515
1616class DiffCommand extends BaseCommand
1717{
18+ /**
19+ * @var PackageDiff
20+ */
21+ protected $ packageDiff ;
22+
23+ public function __construct (PackageDiff $ packageDiff )
24+ {
25+ $ this ->packageDiff = $ packageDiff ;
26+
27+ parent ::__construct ();
28+ }
29+
1830 protected function configure ()
1931 {
2032 $ this ->setName ('diff ' )
@@ -32,15 +44,14 @@ protected function execute(InputInterface $input, OutputInterface $output)
3244 $ base = $ input ->getOption ('base ' );
3345 $ target = $ input ->getOption ('target ' );
3446 $ withPlatform = $ input ->getOption ('with-platform ' );
35- $ diff = new PackageDiff ();
3647
3748 if (!$ input ->getOption ('no-prod ' )) {
38- $ operations = $ diff ->getPackageDiff ($ base , $ target , false , $ withPlatform );
49+ $ operations = $ this -> packageDiff ->getPackageDiff ($ base , $ target , false , $ withPlatform );
3950 $ this ->displayTable ($ operations , 'Prod Packages ' , $ output );
4051 }
4152
4253 if (!$ input ->getOption ('no-dev ' )) {
43- $ operations = $ diff ->getPackageDiff ($ base , $ target , true , $ withPlatform );
54+ $ operations = $ this -> packageDiff ->getPackageDiff ($ base , $ target , true , $ withPlatform );
4455 $ this ->displayTable ($ operations , 'Dev Packages ' , $ output );
4556 }
4657
0 commit comments