2828 */
2929class ShellApplication extends Application
3030{
31- /**
32- * True when application has been initialized once
33- *
34- * @var boolean
35- */
36- protected $ initialized ;
37-
3831 /**
3932 * @var boolean
4033 */
@@ -61,6 +54,7 @@ public function __construct($container)
6154 $ this ->dispatcher = $ container ->get ('event.dispatcher ' ) ? : new EventDispatcher ();
6255 $ this ->setDispatcher ($ this ->dispatcher );
6356 $ this ->container = $ container ;
57+ $ this ->init ();
6458 }
6559
6660 /**
@@ -75,29 +69,16 @@ public function setShowUnsupported($boolean)
7569 }
7670
7771 /**
78- * Initialize the application.
79- *
80- * Note that we do this "lazily" because we instantiate the ShellApplication early,
81- * before the SessionInput has been set. The SessionInput must be set before we
82- * can initialize the application.
83- *
84- * @todo: The above scenario is no longer true, we use a Profile. So maybe it can
85- * be refactored.
72+ * Initialize the application
8673 */
8774 public function init ()
8875 {
89- if (true === $ this ->initialized ) {
90- return ;
91- }
92-
9376 $ this ->registerPhpcrCommands ();
9477 $ this ->registerPhpcrStandaloneCommands ();
9578 $ this ->registerShellCommands ();
9679
9780 $ event = new ApplicationInitEvent ($ this );
9881 $ this ->dispatcher ->dispatch (PhpcrShellEvents::APPLICATION_INIT , $ event );
99-
100- $ this ->initialized = true ;
10182 }
10283
10384 /**
@@ -236,8 +217,6 @@ private function configureFormatter(OutputFormatter $formatter)
236217 */
237218 public function doRun (InputInterface $ input , OutputInterface $ output )
238219 {
239- $ this ->init ();
240-
241220 // configure the formatter for the output
242221 $ this ->configureFormatter ($ output ->getFormatter ());
243222
0 commit comments