Completed
Push — master ( c7c88d...7873ee )
by Mike
02:24
created

SugarAPI::__call()   B

Complexity

Conditions 5
Paths 5

Size

Total Lines 20
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 6
Bugs 2 Features 0
Metric Value
c 6
b 2
f 0
dl 0
loc 20
rs 8.8571
cc 5
eloc 14
nc 5
nop 2
1
<?php
2
3
namespace SugarAPI\SDK;
4
5
use SugarAPI\SDK\Client\Abstracts\AbstractClient;
6
7
/**
8
 * The default SDK Client
9
 * @package SugarAPI\SDK
10
 */
11
class SugarAPI extends AbstractClient {
12
13
    /**
14
     * The configured Authentication options
15
     * @var array
16
     */
17
    protected $credentials = array(
18
        'username' => '',
19
        'password' => '',
20
        'client_id' => 'sugar',
21
        'client_secret' => '',
22
        'platform' => 'api'
23
    );
24
25
    /**
26
     * @inheritdoc
27
     * Overrides only the credentials properties passed in, instead of entire credentials array
28
     */
29
    public function setCredentials(array $credentials){
30
        foreach ($this->credentials as $key => $value){
31
            if (isset($credentials[$key])){
32
                $this->credentials[$key] = $credentials[$key];
33
            }
34
        }
35
        return parent::setCredentials($this->credentials);
36
    }
37
38
}