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

SugarAPI   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 8
Bugs 3 Features 0
Metric Value
wmc 3
c 8
b 3
f 0
lcom 1
cbo 1
dl 0
loc 28
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A setCredentials() 0 8 3
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
}