| Conditions | 7 |
| Paths | 7 |
| Total Lines | 26 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 7.0084 |
| Changes | 1 | ||
| Bugs | 0 | Features | 1 |
| 1 | <?php |
||
| 25 | 11 | private static function before(HttpGetRequest $req) |
|
| 26 | { |
||
| 27 | // no_proxy skip |
||
| 28 | 11 | if (isset($_SERVER['no_proxy'])) { |
|
| 29 | 1 | $pattern = new NoProxyPattern($_SERVER['no_proxy']); |
|
| 30 | 1 | if ($pattern->test($req->getURL())) { |
|
| 31 | 1 | unset($req->curlOpts[CURLOPT_PROXY]); |
|
| 32 | 1 | return; |
|
| 33 | } |
||
| 34 | } |
||
| 35 | |||
| 36 | 10 | $httpProxy = self::issetOr($_SERVER, 'http_proxy', 'HTTP_PROXY'); |
|
| 37 | 10 | if ($httpProxy && $req->scheme === 'http') { |
|
| 38 | 1 | $req->curlOpts[CURLOPT_PROXY] = $httpProxy; |
|
| 39 | 1 | return; |
|
| 40 | } |
||
| 41 | |||
| 42 | 9 | $httpsProxy = self::issetOr($_SERVER, 'https_proxy', 'HTTPS_PROXY'); |
|
| 43 | 9 | if ($httpsProxy && $req->scheme === 'https') { |
|
| 44 | 1 | $req->curlOpts[CURLOPT_PROXY] = $httpsProxy; |
|
| 45 | 1 | return; |
|
| 46 | } |
||
| 47 | |||
| 48 | 8 | unset($req->curlOpts[CURLOPT_PROXY]); |
|
| 49 | 8 | unset($req->curlOpts[CURLOPT_PROXYUSERPWD]); |
|
| 50 | 8 | } |
|
| 51 | |||
| 63 |