File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -135,16 +135,23 @@ public function replaceServiceProvider($key, $serviceProvider)
135135 }
136136
137137 /**
138- * @param $key string
139- * @param $listener string
138+ * @param $key [example: AppEvent::REQUEST]
139+ * @param $listener [example: TastPHP\Framework\Listener\RequestListener]
140+ * @param string $action [example: onRequestAction]
140141 */
141- public function replaceListener ($ key , $ listener )
142+ public function replaceListener ($ key , $ listener, $ action = '' )
142143 {
143144 if (!isset ($ this ->listeners [$ key ])) {
144145 throw new \InvalidArgumentException (sprintf ('The kernel listener "%s" is not defined. ' , $ key ));
145146 }
146147
147- $ this ->listeners [$ key ] = $ listener ;
148+ if (empty ($ action )) {
149+ $ this ->listeners [$ key ] = $ listener ;
150+ }
151+
152+ if (!empty ($ action )) {
153+ $ this ->listeners [$ key ] = $ listener . '@ ' . $ action ;
154+ }
148155 }
149156
150157 /**
You can’t perform that action at this time.
0 commit comments