| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 2 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 29 | public static function create($url, $token) |
||
| 30 | { |
||
| 31 | $plugins = [ |
||
| 32 | new RedirectPlugin(), |
||
| 33 | new RetryPlugin(['retries' => 5]), |
||
| 34 | new DecoderPlugin(), |
||
| 35 | new ErrorPlugin(), |
||
| 36 | ]; |
||
| 37 | |||
| 38 | if ($token) { |
||
| 39 | $plugins[] = new AuthenticationPlugin(new QueryParam([ |
||
| 40 | 'api_key' => $token, |
||
| 41 | ])); |
||
| 42 | } |
||
| 43 | |||
| 44 | $client = new HttpMethodsClient( |
||
| 45 | new PluginClient(HttpClientDiscovery::find(), $plugins), |
||
| 46 | MessageFactoryDiscovery::find() |
||
| 47 | ); |
||
| 48 | |||
| 49 | return new HttpPlugHttpAdapterClient($client, $url); |
||
| 50 | } |
||
| 51 | } |
||
| 52 |