1212 */
1313namespace Tmdb \Event ;
1414
15+ use Symfony \Component \EventDispatcher \EventDispatcherInterface ;
1516use Tmdb \Exception \RuntimeException ;
1617use Tmdb \HttpClient \HttpClientEventSubscriber ;
1718use Tmdb \HttpClient \Response ;
@@ -29,10 +30,17 @@ public static function getSubscribedEvents()
2930 ];
3031 }
3132
32- public function send (RequestEvent $ event )
33+ /**
34+ * @param RequestEvent $event
35+ * @param string $eventName
36+ * @param EventDispatcherInterface $eventDispatcher
37+ *
38+ * @return string|Response
39+ */
40+ public function send (RequestEvent $ event , $ eventName , EventDispatcherInterface $ eventDispatcher )
3341 {
3442 // Preparation of request parameters / Possibility to use for logging and caching etc.
35- $ event -> getDispatcher () ->dispatch (TmdbEvents::BEFORE_REQUEST , $ event );
43+ $ eventDispatcher ->dispatch (TmdbEvents::BEFORE_REQUEST , $ event );
3644
3745 if ($ event ->isPropagationStopped () && $ event ->hasResponse ()) {
3846 return $ event ->getResponse ();
@@ -42,7 +50,7 @@ public function send(RequestEvent $event)
4250 $ event ->setResponse ($ response );
4351
4452 // Possibility to cache the request
45- $ event -> getDispatcher () ->dispatch (TmdbEvents::AFTER_REQUEST , $ event );
53+ $ eventDispatcher ->dispatch (TmdbEvents::AFTER_REQUEST , $ event );
4654
4755 return $ response ;
4856 }
@@ -56,8 +64,6 @@ public function send(RequestEvent $event)
5664 */
5765 public function sendRequest (RequestEvent $ event )
5866 {
59- $ response = null ;
60-
6167 switch ($ event ->getMethod ()) {
6268 case 'GET ' :
6369 $ response = $ this ->getHttpClient ()->getAdapter ()->get ($ event ->getRequest ());
0 commit comments