| Total Complexity | 5 |
| Total Lines | 53 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 8 | final class NovaApiConfiguration |
||
| 9 | { |
||
| 10 | /** |
||
| 11 | * @var array |
||
| 12 | */ |
||
| 13 | private $settings; |
||
| 14 | |||
| 15 | /** |
||
| 16 | * The constructor. |
||
| 17 | * |
||
| 18 | * @param array $settings The settings |
||
| 19 | */ |
||
| 20 | 13 | public function __construct(array $settings = []) |
|
| 21 | { |
||
| 22 | 13 | $this->settings = $settings; |
|
| 23 | 13 | } |
|
| 24 | |||
| 25 | /** |
||
| 26 | * @return string The version |
||
| 27 | */ |
||
| 28 | 13 | public function getNovaApiVersion(): string |
|
| 29 | { |
||
| 30 | 13 | return $this->settings['version'] ?? 'v14'; |
|
| 31 | } |
||
| 32 | |||
| 33 | /** |
||
| 34 | * Get default http settings. |
||
| 35 | * |
||
| 36 | * @return array The settings |
||
| 37 | */ |
||
| 38 | 13 | public function getDefaultHttpSettings(): array |
|
| 39 | { |
||
| 40 | 13 | return (array)$this->settings['default']; |
|
| 41 | } |
||
| 42 | |||
| 43 | /** |
||
| 44 | * Get NOVA OAuth 2 (Single sign-on) settings. |
||
| 45 | * |
||
| 46 | * @return array The settings |
||
| 47 | */ |
||
| 48 | 13 | public function getWebServiceSsoClientSettings(): array |
|
| 49 | { |
||
| 50 | 13 | return array_replace_recursive($this->getDefaultHttpSettings(), $this->settings['sso']); |
|
| 51 | } |
||
| 52 | |||
| 53 | /** |
||
| 54 | * Get NOVA SOAP-Webservice endpoint options. |
||
| 55 | * |
||
| 56 | * @return array The settings |
||
| 57 | */ |
||
| 58 | 13 | public function getWebServiceClientSettings(): array |
|
| 61 | } |
||
| 62 | } |
||
| 63 |