| Conditions | 2 |
| Paths | 2 |
| Total Lines | 23 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 14 |
| CRAP Score | 2.0011 |
| Changes | 0 | ||
| 1 | <?php namespace Vindi\Http; |
||
| 11 | 428 | public function __construct(array $config = []) |
|
|
|
|||
| 12 | { |
||
| 13 | 428 | $vindi = new Vindi; |
|
| 14 | |||
| 15 | 428 | $host = isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : ''; |
|
| 16 | |||
| 17 | 428 | $config = array_merge([ |
|
| 18 | 428 | 'base_uri' => Vindi::getApiBase(), |
|
| 19 | 428 | 'auth' => [$vindi->getApiKey(), '', 'BASIC'], |
|
| 20 | 'headers' => [ |
||
| 21 | 428 | 'Content-Type' => 'application/json', |
|
| 22 | 428 | 'User-Agent' => trim('Vindi-PHP/' . Vindi::$sdkVersion . "; {$host}"), |
|
| 23 | 428 | ], |
|
| 24 | 428 | 'verify' => $vindi->getCertPath(), |
|
| 25 | 428 | 'timeout' => 60, |
|
| 26 | 'curl.options' => [ |
||
| 27 | 428 | 'CURLOPT_SSLVERSION' => 'CURL_SSLVERSION_TLSv1_2', |
|
| 28 | ] |
||
| 29 | 428 | ], $config); |
|
| 30 | |||
| 31 | |||
| 32 | 428 | parent::__construct($config); |
|
| 33 | } |
||
| 34 | } |
||
| 35 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: