-
Notifications
You must be signed in to change notification settings - Fork 26
/
Copy pathClientConfiguration.php
49 lines (44 loc) · 1.56 KB
/
ClientConfiguration.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace Tmdb\SymfonyBundle;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use Psr\Http\Message\ResponseFactoryInterface;
use Psr\Http\Message\StreamFactoryInterface;
use Psr\Http\Message\UriFactoryInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Symfony\Component\HttpFoundation\ParameterBag;
use Tmdb\ConfigurationInterface;
use Tmdb\Token\Api\ApiToken;
/**
* Class ClientConfiguration
* @package Tmdb\SymfonyBundle
*/
class ClientConfiguration extends ParameterBag implements ConfigurationInterface
{
/**
* ClientConfiguration constructor.
*
* @param array<string, mixed> $options
*/
public function __construct(
ApiToken $apiToken,
EventDispatcherInterface $eventDispatcher,
ClientInterface $client,
RequestFactoryInterface $requestFactory,
ResponseFactoryInterface $responseFactory,
StreamFactoryInterface $streamFactory,
UriFactoryInterface $uriFactory,
array $options = []
) {
$options['api_token'] = $apiToken;
$options['event_dispatcher']['adapter'] = $eventDispatcher;
$options['http']['client'] = $client;
$options['http']['request_factory'] = $requestFactory;
$options['http']['response_factory'] = $responseFactory;
$options['http']['stream_factory'] = $streamFactory;
$options['http']['uri_factory'] = $uriFactory;
// Library handles it as an api_token
unset($options['bearer_token']);
parent::__construct($options);
}
}