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

SugarAPI::setInstance()   A

Complexity

Conditions 3
Paths 4

Size

Total Lines 10
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

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