12
12
13
13
namespace PHPCR \Shell \Console \Application ;
14
14
15
- use PHPCR \Shell \Config \Profile ;
16
15
use PHPCR \Shell \Console \Command \Phpcr as CommandPhpcr ;
17
16
use PHPCR \Shell \Console \Command \Phpcr \BasePhpcrCommand ;
18
17
use PHPCR \Shell \Console \Command \Shell as CommandShell ;
@@ -57,6 +56,11 @@ class ShellApplication extends Application
57
56
*/
58
57
protected $ initialized = false ;
59
58
59
+ /**
60
+ * @var EventDispatcher
61
+ */
62
+ private $ dispatcher ;
63
+
60
64
/**
61
65
* Constructor - name and version inherited from SessionApplication.
62
66
*
@@ -95,7 +99,7 @@ public function init()
95
99
$ this ->registerShellCommands ();
96
100
97
101
$ event = new ApplicationInitEvent ($ this );
98
- $ this ->dispatcher ->dispatch (PhpcrShellEvents::APPLICATION_INIT , $ event );
102
+ $ this ->dispatcher ->dispatch ($ event , PhpcrShellEvents::APPLICATION_INIT );
99
103
$ this ->initialized = true ;
100
104
}
101
105
@@ -242,7 +246,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
242
246
$ name = $ this ->getCommandName ($ input );
243
247
244
248
$ event = new Event \CommandPreRunEvent ($ name , $ input );
245
- $ this ->dispatcher ->dispatch (PhpcrShellEvents::COMMAND_PRE_RUN , $ event );
249
+ $ this ->dispatcher ->dispatch ($ event , PhpcrShellEvents::COMMAND_PRE_RUN );
246
250
$ input = $ event ->getInput ();
247
251
248
252
if (!$ name ) {
@@ -252,7 +256,7 @@ public function doRun(InputInterface $input, OutputInterface $output)
252
256
try {
253
257
$ exitCode = parent ::doRun ($ input , $ output );
254
258
} 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 );
256
260
257
261
return 1 ;
258
262
}
@@ -292,7 +296,7 @@ public function add(Command $command)
292
296
public function dispatchProfileInitEvent (InputInterface $ sessionInput , OutputInterface $ output )
293
297
{
294
298
$ 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 );
296
300
}
297
301
298
302
/**
0 commit comments