$token, //'secure' => true, 'base_uri' => Client::TMDB_URI, 'event_dispatcher' => [ 'adapter' => $ed ] ]); $requestListener = new RequestListener($client->getHttpClient(), $ed); $ed->addListener(RequestEvent::class, $requestListener); $apiTokenListener = new ApiTokenRequestListener($client->getToken()); $ed->addListener(BeforeRequestEvent::class, $apiTokenListener); $acceptJSONListener = new AcceptJsonRequestListener(); $ed->addListener(BeforeRequestEvent::class, $acceptJSONListener); $jsonContentTypeListener = new ContentTypeJsonRequestListener(); $ed->addListener(BeforeRequestEvent::class, $jsonContentTypeListener); $userAgentListener = new UserAgentRequestListener(); $ed->addListener(BeforeRequestEvent::class, $userAgentListener); $requestLoggerListener = new LogHttpMessageListener( $logger, new \Tmdb\Formatter\HttpMessage\FullHttpMessageFormatter() ); $ed->addListener(BeforeRequestEvent::class, $requestLoggerListener); $ed->addListener(ResponseEvent::class, $requestLoggerListener); $ed->addListener(HttpClientExceptionEvent::class, $requestLoggerListener); $ed->addListener(LogApiErrorListener::class, $requestLoggerListener); $langFilterListener = new LanguageFilterRequestListener('de-DE'); $ed->addListener(BeforeRequestEvent::class, $langFilterListener); return $client; } }