ReportingCloud   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 23
Bugs 0 Features 0
Metric Value
wmc 4
eloc 19
c 23
b 0
f 0
dl 0
loc 37
ccs 15
cts 15
cp 1
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 22 4
1
<?php
2
declare(strict_types=1);
3
4
/**
5
 * ReportingCloud PHP SDK
6
 *
7
 * PHP SDK for ReportingCloud Web API. Authored and supported by Text Control GmbH.
8
 *
9
 * @link      https://www.reporting.cloud to learn more about ReportingCloud
10
 * @link      https://git.io/Jejj2 for the canonical source repository
11
 * @license   https://git.io/Jejjr
12
 * @copyright © 2022 Text Control GmbH
13
 */
14
15
namespace TxTextControl\ReportingCloud;
16
17
/**
18
 * Class ReportingCloud
19
 *
20
 * @package TxTextControl\ReportingCloud
21
 * @author  Jonathan Maron (@JonathanMaron)
22
 */
23
class ReportingCloud extends AbstractReportingCloud
24
{
25
    use BuildTrait;
26
    use DeleteTrait;
27
    use GetTrait;
28
    use PostTrait;
29
    use PutTrait;
30
31
    // <editor-fold desc="Methods">
32
33
    /**
34
     * ReportingCloud constructor
35
     *
36
     * @param array $options
37
     */
38 194
    public function __construct(array $options = [])
39
    {
40 194
        if (count($options) > 0) {
41
42 188
            $methods = [
43
                // Credentials
44 188
                'api_key'  => 'setApiKey',
45
                // Credentials (deprecated, use 'api_key' only)
46 188
                'username' => 'setUsername',
47 188
                'password' => 'setPassword',
48
                // Options
49 188
                'base_uri' => 'setBaseUri',
50 188
                'debug'    => 'setDebug',
51 188
                'test'     => 'setTest',
52 188
                'timeout'  => 'setTimeout',
53 188
                'version'  => 'setVersion',
54 188
            ];
55
56 188
            foreach ($methods as $key => $method) {
57 188
                if (array_key_exists($key, $options)) {
58
                    // @phpstan-ignore-next-line
59 188
                    $this->$method($options[$key]);
60
                }
61
            }
62
        }
63
    }
64
65
    // </editor-fold>
66
}
67