35
35
use Symfony \Component \Console \Event \ConsoleTerminateEvent ;
36
36
use Symfony \Component \Console \Exception \CommandNotFoundException ;
37
37
use Symfony \Component \Console \Exception \LogicException ;
38
- use Symfony \Component \Console \Terminal \ TerminalDimensionsProvider ;
38
+ use Symfony \Component \Console \Terminal ;
39
39
use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
40
40
41
41
/**
@@ -65,23 +65,18 @@ class Application
65
65
private $ definition ;
66
66
private $ helperSet ;
67
67
private $ dispatcher ;
68
+ private $ terminal ;
68
69
private $ defaultCommand ;
69
70
70
71
/**
71
- * @var TerminalDimensionsProvider
72
+ * @param string $name The name of the application
73
+ * @param string $version The version of the application
72
74
*/
73
- private $ terminalDimensionsProvider ;
74
-
75
- /**
76
- * @param string $name The name of the application
77
- * @param string $version The version of the application
78
- * @param TerminalDimensionsProvider $terminalDimensionsProvider
79
- */
80
- public function __construct ($ name = 'UNKNOWN ' , $ version = 'UNKNOWN ' , TerminalDimensionsProvider $ terminalDimensionsProvider = null )
75
+ public function __construct ($ name = 'UNKNOWN ' , $ version = 'UNKNOWN ' )
81
76
{
82
77
$ this ->name = $ name ;
83
78
$ this ->version = $ version ;
84
- $ this ->terminalDimensionsProvider = $ terminalDimensionsProvider ?: new TerminalDimensionsProvider ();
79
+ $ this ->terminal = new Terminal ();
85
80
$ this ->defaultCommand = 'list ' ;
86
81
$ this ->helperSet = $ this ->getDefaultHelperSet ();
87
82
$ this ->definition = $ this ->getDefaultInputDefinition ();
@@ -688,7 +683,7 @@ public function renderException(\Exception $e, OutputInterface $output)
688
683
*/
689
684
protected function getTerminalWidth ()
690
685
{
691
- return $ this ->terminalDimensionsProvider -> getTerminalWidth ();
686
+ return $ this ->terminal -> getWidth ();
692
687
}
693
688
694
689
/**
@@ -698,7 +693,7 @@ protected function getTerminalWidth()
698
693
*/
699
694
protected function getTerminalHeight ()
700
695
{
701
- return $ this ->terminalDimensionsProvider -> getTerminalWidth ();
696
+ return $ this ->terminal -> getHeight ();
702
697
}
703
698
704
699
/**
@@ -708,7 +703,7 @@ protected function getTerminalHeight()
708
703
*/
709
704
public function getTerminalDimensions ()
710
705
{
711
- return $ this ->terminalDimensionsProvider -> getTerminalDimensions ();
706
+ return $ this ->terminal -> getDimensions ();
712
707
}
713
708
714
709
/**
@@ -723,7 +718,7 @@ public function getTerminalDimensions()
723
718
*/
724
719
public function setTerminalDimensions ($ width , $ height )
725
720
{
726
- $ this ->terminalDimensionsProvider -> setTerminalDimensions ($ width , $ height );
721
+ $ this ->terminal -> setDimensions ($ width , $ height );
727
722
728
723
return $ this ;
729
724
}
0 commit comments