Passed
Push — master ( a979ef...44e6f2 )
by Jonathan
09:57 queued 01:06
created

ReportingCloud::__construct()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 16
Code Lines 12

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 13
CRAP Score 3

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 16
ccs 13
cts 13
cp 1
rs 9.4285
cc 3
eloc 12
nc 3
nop 1
crap 3
1
<?php
2
3
/**
4
 * ReportingCloud PHP Wrapper
5
 *
6
 * PHP wrapper for ReportingCloud Web API. Authored and supported by Text Control GmbH.
7
 *
8
 * @link      http://www.reporting.cloud to learn more about ReportingCloud
9
 * @link      https://github.com/TextControl/txtextcontrol-reportingcloud-php for the canonical source repository
10
 * @license   https://raw.githubusercontent.com/TextControl/txtextcontrol-reportingcloud-php/master/LICENSE.md
11
 * @copyright © 2018 Text Control GmbH
12
 */
13
14
namespace TxTextControl\ReportingCloud;
15
16
/**
17
 * Class ReportingCloud
18
 *
19
 * @package TxTextControl\ReportingCloud
20
 * @author  Jonathan Maron (@JonathanMaron)
21
 */
22
class ReportingCloud extends AbstractReportingCloud
23
{
24
    use BuildTrait;
25
    use DeleteTrait;
26
    use GetTrait;
27
    use PostTrait;
28
    use PutTrait;
29
    use UtilityTrait;
30
31
    /**
32
     * Constructor Method
33
     * -----------------------------------------------------------------------------------------------------------------
34
     */
35
36
    /**
37
     * ReportingCloud constructor
38
     *
39
     * @param array $options
40
     */
41 132
    public function __construct(array $options = [])
42
    {
43
        $methods = [
44 132
            'api_key'  => 'setApiKey',
45 66
            'base_uri' => 'setBaseUri',
46 66
            'debug'    => 'setDebug',
47 66
            'password' => 'setPassword',
48 66
            'test'     => 'setTest',
49 66
            'timeout'  => 'setTimeout',
50 66
            'username' => 'setUsername',
51 66
            'version'  => 'setVersion',
52 66
        ];
53
54 132
        foreach ($methods as $key => $method) {
55 132
            if (array_key_exists($key, $options)) {
56 67
                $this->$method($options[$key]);
57 1
            }
58 66
        }
59 132
    }
60
}
61