NovaApiConfiguration   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 53
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 53
ccs 11
cts 11
cp 1
rs 10
wmc 5

5 Methods

Rating   Name   Duplication   Size   Complexity  
A getWebServiceClientSettings() 0 3 1
A getWebServiceSsoClientSettings() 0 3 1
A getNovaApiVersion() 0 3 1
A getDefaultHttpSettings() 0 3 1
A __construct() 0 3 1
1
<?php
2
3
namespace OrcaServices\NovaApi\Configuration;
4
5
/**
6
 * Configuration.
7
 */
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
59
    {
60 13
        return array_replace_recursive($this->getDefaultHttpSettings(), $this->settings['webservice']);
61
    }
62
}
63