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