| Conditions | 8 |
| Paths | 8 |
| Total Lines | 20 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 46 | protected function HTTPOptionsTrait():void{ |
||
| 47 | |||
| 48 | if(!is_array($this->curl_options)){ |
||
| 49 | $this->curl_options = []; |
||
| 50 | } |
||
| 51 | |||
| 52 | // we cannot verify a peer against a non-existent ca file, so turn it off in that case |
||
| 53 | if(!$this->ca_info || !is_file($this->ca_info) |
||
| 54 | || (isset($this->curl_options[CURLOPT_CAINFO]) && !is_file($this->curl_options[CURLOPT_CAINFO]))){ |
||
| 55 | |||
| 56 | $this->curl_options += [ |
||
| 57 | CURLOPT_SSL_VERIFYPEER => false, |
||
| 58 | CURLOPT_CAINFO => null, |
||
| 59 | ]; |
||
| 60 | } |
||
| 61 | |||
| 62 | if(!is_string($this->user_agent) || empty(trim($this->user_agent))){ |
||
| 63 | throw new ClientException('invalid user agent'); |
||
| 64 | } |
||
| 65 | } |
||
| 66 | |||
| 68 |