1 | <?php |
||
13 | class Config extends SoapConfig |
||
14 | { |
||
15 | const DEFAULT_RESPONSE_TIMEOUT = 20; |
||
16 | const RETRY_MINUTES = 60; |
||
17 | const SOAPHEADER_URL = 'http://www.webservices.nl/soap/'; |
||
18 | |||
19 | /** |
||
20 | * List with Soap Server endpoints. |
||
21 | * |
||
22 | * @var array |
||
23 | */ |
||
24 | protected static $endPoints = [ |
||
25 | 'https://ws1.webservices.nl/soap', |
||
26 | 'https://ws2.webservices.nl/soap', |
||
27 | ]; |
||
28 | |||
29 | /** |
||
30 | * Config constructor. |
||
31 | * |
||
32 | * @param PlatformConfig $config |
||
33 | */ |
||
34 | 11 | public function __construct(PlatformConfig $config) |
|
35 | { |
||
36 | 11 | $this->converter = Converter::build(); |
|
37 | 11 | $this->soapHeaders[] = new \SoapHeader( |
|
38 | 11 | self::SOAPHEADER_URL, |
|
39 | 11 | 'HeaderLogin', |
|
40 | [ |
||
41 | 11 | 'username' => $config->getUserName(), |
|
42 | 11 | 'password' => $config->getPassword(), |
|
43 | 11 | ], |
|
44 | true |
||
45 | 11 | ); |
|
46 | |||
47 | 11 | parent::__construct($config); |
|
48 | 11 | } |
|
49 | |||
50 | /** |
||
51 | * @return Converter |
||
52 | */ |
||
53 | 10 | public function getConverter() |
|
57 | |||
58 | /** |
||
59 | * @return int |
||
60 | */ |
||
61 | 1 | public function getConnectionTimeout() |
|
65 | |||
66 | /** |
||
67 | * @return string |
||
68 | */ |
||
69 | 1 | public function getPassword() |
|
73 | |||
74 | /** |
||
75 | * @return int |
||
76 | */ |
||
77 | 1 | public function getRetryMinutes() |
|
81 | |||
82 | /** |
||
83 | * @return int |
||
84 | */ |
||
85 | 1 | public function getResponseTimeout() |
|
89 | |||
90 | /** |
||
91 | * @return array |
||
92 | */ |
||
93 | 9 | public function getSoapHeaders() |
|
97 | |||
98 | /** |
||
99 | * @return string |
||
100 | */ |
||
101 | 2 | public function getUserName() |
|
105 | |||
106 | /** |
||
107 | * @return array |
||
108 | */ |
||
109 | 2 | public function toArray() |
|
110 | { |
||
111 | 2 | return array_filter([ |
|
112 | 2 | 'converter' => $this->getConverter(), |
|
113 | 2 | 'connection_timeout' => $this->getPlatformConfig()->getConnectionTimeout(), |
|
114 | 2 | 'endpoints' => self::$endPoints, |
|
115 | 2 | 'password' => $this->getPlatformConfig()->getPassword(), |
|
116 | 2 | 'retry_minutes' => $this->getPlatformConfig()->getRetryMinutes(), |
|
117 | 2 | 'soap_headers' => (array)$this->getSoapHeaders(), |
|
118 | 2 | 'timeout' => $this->getPlatformConfig()->getResponseTimeout(), |
|
119 | 2 | 'username' => $this->getPlatformConfig()->getUserName(), |
|
120 | 2 | ]); |
|
121 | } |
||
122 | |||
123 | /** |
||
124 | * @return PlatformConfig |
||
125 | */ |
||
126 | 10 | public function getPlatformConfig() |
|
130 | } |
||
131 |