| Total Complexity | 7 |
| Total Lines | 86 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 13 | trait HttpTrait |
||
| 14 | { |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var array |
||
| 18 | */ |
||
| 19 | public $options = []; |
||
| 20 | |||
| 21 | /** |
||
| 22 | * @param int|float $timeout |
||
| 23 | * |
||
| 24 | * @return $this |
||
| 25 | * @throws ClientException |
||
| 26 | */ |
||
| 27 | public function timeout($timeout) |
||
| 28 | { |
||
| 29 | $this->options['timeout'] = ClientFilter::timeout($timeout); |
||
| 30 | |||
| 31 | return $this; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * @param int|float $connectTimeout |
||
| 36 | * |
||
| 37 | * @return $this |
||
| 38 | * @throws ClientException |
||
| 39 | */ |
||
| 40 | public function connectTimeout($connectTimeout) |
||
| 41 | { |
||
| 42 | $this->options['connect_timeout'] = ClientFilter::connectTimeout($connectTimeout); |
||
| 43 | |||
| 44 | return $this; |
||
| 45 | } |
||
| 46 | |||
| 47 | /** |
||
| 48 | * @param bool $debug |
||
| 49 | * |
||
| 50 | * @return $this |
||
| 51 | */ |
||
| 52 | public function debug($debug) |
||
| 53 | { |
||
| 54 | $this->options['debug'] = $debug; |
||
| 55 | |||
| 56 | return $this; |
||
| 57 | } |
||
| 58 | |||
| 59 | /** |
||
| 60 | * @codeCoverageIgnore |
||
| 61 | * |
||
| 62 | * @param array $cert |
||
| 63 | * |
||
| 64 | * @return $this |
||
| 65 | */ |
||
| 66 | public function cert($cert) |
||
| 67 | { |
||
| 68 | $this->options['cert'] = $cert; |
||
| 69 | |||
| 70 | return $this; |
||
| 71 | } |
||
| 72 | |||
| 73 | /** |
||
| 74 | * @codeCoverageIgnore |
||
| 75 | * |
||
| 76 | * @param array|string $proxy |
||
| 77 | * |
||
| 78 | * @return $this |
||
| 79 | */ |
||
| 80 | public function proxy($proxy) |
||
| 81 | { |
||
| 82 | $this->options['proxy'] = $proxy; |
||
| 83 | |||
| 84 | return $this; |
||
| 85 | } |
||
| 86 | |||
| 87 | /** |
||
| 88 | * @param array $options |
||
| 89 | * |
||
| 90 | * @return $this |
||
| 91 | */ |
||
| 92 | public function options(array $options) |
||
| 99 | } |
||
| 100 | } |