| Conditions | 2 |
| Paths | 2 |
| Total Lines | 30 |
| Code Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | public function parse() { |
||
| 34 | $proxy = $this->config->getSystemValue('proxy'); |
||
| 35 | $userpasswd = $this->config->getSystemValue('proxyuserpwd'); |
||
| 36 | |||
| 37 | $result = [ |
||
| 38 | 'host' => null, |
||
| 39 | 'port' => null, |
||
| 40 | 'user' => null, |
||
| 41 | 'password' => null |
||
| 42 | ]; |
||
| 43 | |||
| 44 | // we need to filter out the port -.- |
||
| 45 | $url = new \Net_URL2($proxy); |
||
| 46 | $port = $url->getPort(); |
||
| 47 | |||
| 48 | $url->setPort(false); |
||
| 49 | $host = $url->getUrl(); |
||
| 50 | |||
| 51 | |||
| 52 | $result['host'] = $host; |
||
| 53 | $result['port'] = $port; |
||
| 54 | |||
| 55 | if ($userpasswd) { |
||
| 56 | $auth = explode(':', $userpasswd, 2); |
||
| 57 | $result['user'] = $auth[0]; |
||
| 58 | $result['password'] = $auth[1]; |
||
| 59 | } |
||
| 60 | |||
| 61 | return $result; |
||
| 62 | } |
||
| 63 | |||
| 65 | } |