| 1: | <?php |
| 2: | namespace Worldline\Acquiring\Sdk; |
| 3: | |
| 4: | |
| 5: | |
| 6: | |
| 7: | |
| 8: | |
| 9: | class ProxyConfiguration |
| 10: | { |
| 11: | |
| 12: | |
| 13: | |
| 14: | private ?string $host = null; |
| 15: | |
| 16: | |
| 17: | |
| 18: | private $port = null; |
| 19: | |
| 20: | |
| 21: | |
| 22: | private ?string $username = null; |
| 23: | |
| 24: | |
| 25: | |
| 26: | private ?string $password = null; |
| 27: | |
| 28: | |
| 29: | |
| 30: | |
| 31: | |
| 32: | |
| 33: | |
| 34: | public function __construct(string $host, $port = null, string $username = null, string $password = null) |
| 35: | { |
| 36: | if ($host) { |
| 37: | $this->host = $host; |
| 38: | $this->port = $port; |
| 39: | $this->username = $username; |
| 40: | $this->password = $password; |
| 41: | } |
| 42: | } |
| 43: | |
| 44: | |
| 45: | |
| 46: | |
| 47: | public function getCurlProxy(): string |
| 48: | { |
| 49: | if (!is_null($this->host)) { |
| 50: | return $this->host . (is_null($this->port) ? '' : ':'. $this->port); |
| 51: | } |
| 52: | return ''; |
| 53: | } |
| 54: | |
| 55: | |
| 56: | |
| 57: | |
| 58: | public function getCurlProxyUserPwd(): string |
| 59: | { |
| 60: | if (!is_null($this->username)) { |
| 61: | return $this->username . (is_null($this->password) ? '' : ':'. $this->password); |
| 62: | } |
| 63: | return ''; |
| 64: | } |
| 65: | } |
| 66: | |