1212
1313namespace PHPCR \Shell \Console \Application ;
1414
15- use PHPCR \Shell \Config \Profile ;
1615use PHPCR \Shell \Console \Command \Phpcr as CommandPhpcr ;
1716use PHPCR \Shell \Console \Command \Phpcr \BasePhpcrCommand ;
1817use PHPCR \Shell \Console \Command \Shell as CommandShell ;
@@ -57,6 +56,11 @@ class ShellApplication extends Application
5756 */
5857 protected $ initialized = false ;
5958
59+ /**
60+ * @var EventDispatcher
61+ */
62+ private $ dispatcher ;
63+
6064 /**
6165 * Constructor - name and version inherited from SessionApplication.
6266 *
@@ -95,7 +99,7 @@ public function init()
9599 $ this ->registerShellCommands ();
96100
97101 $ event = new ApplicationInitEvent ($ this );
98- $ this ->dispatcher ->dispatch (PhpcrShellEvents::APPLICATION_INIT , $ event );
102+ $ this ->dispatcher ->dispatch ($ event , PhpcrShellEvents::APPLICATION_INIT );
99103 $ this ->initialized = true ;
100104 }
101105
@@ -242,7 +246,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
242246 $ name = $ this ->getCommandName ($ input );
243247
244248 $ event = new Event \CommandPreRunEvent ($ name , $ input );
245- $ this ->dispatcher ->dispatch (PhpcrShellEvents::COMMAND_PRE_RUN , $ event );
249+ $ this ->dispatcher ->dispatch ($ event , PhpcrShellEvents::COMMAND_PRE_RUN );
246250 $ input = $ event ->getInput ();
247251
248252 if (!$ name ) {
@@ -252,7 +256,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
252256 try {
253257 $ exitCode = parent ::doRun ($ input , $ output );
254258 } catch (\Exception $ e ) {
255- $ this ->dispatcher ->dispatch (PhpcrShellEvents:: COMMAND_EXCEPTION , new Event \CommandExceptionEvent ($ e , $ this , $ output ));
259+ $ this ->dispatcher ->dispatch (new Event \CommandExceptionEvent ($ e , $ this , $ output ), PhpcrShellEvents:: COMMAND_EXCEPTION );
256260
257261 return 1 ;
258262 }
@@ -292,7 +296,7 @@ public function add(Command $command)
292296 public function dispatchProfileInitEvent (InputInterface $ sessionInput , OutputInterface $ output )
293297 {
294298 $ event = new Event \ProfileInitEvent ($ this ->container ->get ('config.profile ' ), $ sessionInput , $ output );
295- $ this ->dispatcher ->dispatch (PhpcrShellEvents::PROFILE_INIT , $ event );
299+ $ this ->dispatcher ->dispatch ($ event , PhpcrShellEvents::PROFILE_INIT );
296300 }
297301
298302 /**
0 commit comments