Conditions | 3 |
Paths | 3 |
Total Lines | 25 |
Code Lines | 15 |
Lines | 0 |
Ratio | 0 % |
Tests | 10 |
CRAP Score | 3 |
Changes | 0 |
1 | <?php |
||
15 | 7 | public function createFromArray(array $config) |
|
16 | { |
||
17 | $requiredParams = [ |
||
18 | 7 | 'client_credentials_identifier', |
|
19 | 'client_credentials_secret', |
||
20 | 'temporary_credentials_uri', |
||
21 | 'authorization_uri', |
||
22 | 'token_credentials_uri', |
||
23 | ]; |
||
24 | |||
25 | 7 | foreach ($requiredParams as $param) { |
|
26 | 7 | if (! isset($config[$param])) { |
|
27 | 7 | throw new InvalidArgumentException("Missing OAuth1 client configuration: {$param}."); |
|
28 | } |
||
29 | } |
||
30 | |||
31 | 2 | $clientCredentials = new ClientCredentials( |
|
32 | 2 | $config['client_credentials_identifier'], |
|
33 | 2 | $config['client_credentials_secret'] |
|
34 | ); |
||
35 | |||
36 | 2 | $uriConfig = new UriConfig($config, new UriParser); |
|
37 | |||
38 | 2 | return new Config($clientCredentials, $uriConfig); |
|
39 | } |
||
40 | } |
||
41 |