| Conditions | 2 |
| Paths | 2 |
| Total Lines | 28 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | protected function populateConfig(ArrayObject $config) |
||
| 22 | { |
||
| 23 | $config->defaults([ |
||
| 24 | 'payum.factory_name' => self::FACTORY_NAME, |
||
| 25 | 'payum.factory_title' => 'coinbase', |
||
| 26 | 'payum.http_client' => '@bitbag_sylius_coinbase_plugin.api_client.coinbase', |
||
| 27 | ]); |
||
| 28 | |||
| 29 | if (false === (bool) $config['payum.api']) { |
||
| 30 | $config['payum.default_options'] = [ |
||
| 31 | 'apiKey' => null, |
||
| 32 | ]; |
||
| 33 | |||
| 34 | $config->defaults($config['payum.default_options']); |
||
| 35 | |||
| 36 | $config['payum.required_options'] = [ |
||
| 37 | 'apiKey', |
||
| 38 | ]; |
||
| 39 | |||
| 40 | $config['payum.api'] = function (ArrayObject $config) { |
||
| 41 | $config->validateNotEmpty($config['payum.required_options']); |
||
| 42 | |||
| 43 | /** @var CoinbaseApiClientInterface $coinbaseApiClient */ |
||
| 44 | $coinbaseApiClient = $config['payum.http_client']; |
||
| 45 | |||
| 46 | $coinbaseApiClient->initialise($config['apiKey']); |
||
| 47 | |||
| 48 | return $coinbaseApiClient; |
||
| 49 | }; |
||
| 53 |