NovaApiConfiguration::getDefaultHttpSettings()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
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