host = $host; $this->port = $port; $this->login = $login; $this->password = $password; $this->authenticationType = $authenticationType; } public function getHost() { return $this->host; } public function getPort() { return $this->port; } public function hasCredentials() { return $this->login !== null; } public function getLogin() { return $this->login; } public function getPassword() { return $this->password; } public function hasAuthenticationType() { return $this->authenticationType !== self::PROXY_AUTHENTICATION_TYPE_NONE; } public function getAuthenticationType() { return $this->authenticationType; } public function toArray() { $proxyAsArray = [ 'proxy_host' => $this->getHost(), 'proxy_port' => $this->getPort(), ]; if ($this->hasCredentials()) { $proxyAsArray['proxy_login'] = $this->getLogin(); $proxyAsArray['proxy_password'] = $this->getPassword(); } if ($this->hasAuthenticationType()) { $proxyAsArray['proxy_auth'] = $this->getAuthenticationType(); } return $proxyAsArray; } }