1 | <?php |
||
24 | final class ClientConfigurator |
||
25 | { |
||
26 | /** |
||
27 | * @var string |
||
28 | */ |
||
29 | private $endpoint = 'https://sylius.com/api/v1'; |
||
30 | |||
31 | /** |
||
32 | * @var UriFactory |
||
33 | */ |
||
34 | private $uriFactory; |
||
35 | |||
36 | /** |
||
37 | * This is the client we use for actually sending the requests. |
||
38 | * |
||
39 | * @var HttpClient |
||
40 | */ |
||
41 | private $httpClient; |
||
42 | |||
43 | /** |
||
44 | * This is the client wrapping the $httpClient. |
||
45 | * |
||
46 | * @var PluginClient |
||
47 | */ |
||
48 | private $configuredClient; |
||
49 | |||
50 | /** |
||
51 | * @var Plugin[] |
||
52 | */ |
||
53 | private $prependPlugins = []; |
||
54 | |||
55 | /** |
||
56 | * @var Plugin[] |
||
57 | */ |
||
58 | private $appendPlugins = []; |
||
59 | |||
60 | /** |
||
61 | * True if we should create a new Plugin client at next request. |
||
62 | * |
||
63 | * @var bool |
||
64 | */ |
||
65 | private $configurationModified = true; |
||
66 | |||
67 | 4 | public function __construct(HttpClient $httpClient = null, UriFactory $uriFactory = null) |
|
72 | |||
73 | public function createConfiguredClient(): HttpClient |
||
91 | |||
92 | public function setEndpoint(string $endpoint): void |
||
96 | |||
97 | 2 | public function appendPlugin(Plugin ...$plugin): void |
|
104 | |||
105 | 2 | public function prependPlugin(Plugin ...$plugin): void |
|
113 | |||
114 | /** |
||
115 | * Remove a plugin by its fully qualified class name (FQCN). |
||
116 | */ |
||
117 | public function removePlugin(string $fqcn): void |
||
133 | } |
||
134 |