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