1 | <?php |
||
12 | class WsdlManager |
||
13 | { |
||
14 | |||
15 | /** |
||
16 | * @var WebServiceFactoryInterface |
||
17 | */ |
||
18 | protected $webServiceFactory; |
||
19 | |||
20 | /** |
||
21 | * @var Config |
||
22 | */ |
||
23 | protected $config; |
||
24 | |||
25 | /** |
||
26 | * Aliasy webových služeb pro rychlý přístup |
||
27 | * |
||
28 | * @var array |
||
29 | */ |
||
30 | protected $aliases = [ |
||
31 | "user" => "UserManagement", |
||
32 | "usr" => "UserManagement", |
||
33 | "org" => "OrganizationUnit", |
||
34 | "app" => "ApplicationManagement", |
||
35 | "event" => "Events", |
||
36 | "events" => "Events", |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * Dostupné webové služby SkautISu |
||
41 | * |
||
42 | * @var array |
||
43 | */ |
||
44 | protected $supportedWebServices = [ |
||
45 | "ApplicationManagement", |
||
46 | "ContentManagement", |
||
47 | "DocumentStorage", |
||
48 | "Evaluation", |
||
49 | "Events", |
||
50 | "Exports", |
||
51 | "GoogleApps", |
||
52 | "Grants", |
||
53 | "Insurance", |
||
54 | "Journal", |
||
55 | "Material", |
||
56 | "Message", |
||
57 | "OrganizationUnit", |
||
58 | "Power", |
||
59 | "Reports", |
||
60 | "Summary", |
||
61 | "Task", |
||
62 | "Telephony", |
||
63 | "UserManagement", |
||
64 | "Vivant", |
||
65 | "Welcome", |
||
66 | ]; |
||
67 | |||
68 | /** |
||
69 | * @var array |
||
70 | */ |
||
71 | protected $webServiceListeners = []; |
||
72 | |||
73 | /** |
||
74 | * Pole aktivních webových služeb |
||
75 | * |
||
76 | * @var array |
||
77 | */ |
||
78 | protected $webServices = []; |
||
79 | |||
80 | |||
81 | /** |
||
82 | * @param WebServiceFactoryInterface $webServiceFactory továrna pro vytváření objektů webových služeb |
||
83 | * @param Config $config |
||
84 | */ |
||
85 | 3 | public function __construct(WebServiceFactoryInterface $webServiceFactory, Config $config) |
|
90 | |||
91 | /** |
||
92 | * @return Config |
||
93 | */ |
||
94 | public function getConfig() |
||
98 | |||
99 | /** |
||
100 | * Získá objekt webové služby |
||
101 | * |
||
102 | * @param string $name jméno nebo alias webové služby |
||
103 | * @param string|null $loginId skautIS login token |
||
104 | * @return WebServiceInterface |
||
105 | */ |
||
106 | 1 | public function getWebService($name, $loginId = null) |
|
119 | |||
120 | /** |
||
121 | * Vytváří objekt webové služby |
||
122 | * |
||
123 | * @param string $name jméno webové služby |
||
124 | * @param array $options volby pro SoapClient |
||
125 | * @return WebService|mixed |
||
126 | */ |
||
127 | 1 | public function createWebService($name, array $options = []) |
|
140 | |||
141 | /** |
||
142 | * Vrací celé jméno webové služby |
||
143 | * |
||
144 | * @param string $name jméno nebo alias webové služby |
||
145 | * @return string |
||
146 | * @throws WsdlException |
||
147 | */ |
||
148 | 1 | protected function getWebServiceName($name) |
|
160 | |||
161 | /** |
||
162 | * Vrací URL webové služby podle jejího jména |
||
163 | * |
||
164 | * @param string $name celé jméno webové služby |
||
165 | * @return string |
||
166 | */ |
||
167 | 1 | protected function getWebServiceUrl($name) |
|
171 | |||
172 | /** |
||
173 | * Vrací seznam webových služeb, které podporuje |
||
174 | * |
||
175 | * @return array |
||
176 | */ |
||
177 | 1 | public function getSupportedWebServices() |
|
181 | |||
182 | /** |
||
183 | * @return bool |
||
184 | */ |
||
185 | public function isMaintenance() |
||
186 | { |
||
187 | $headers = get_headers($this->getWebServiceUrl("UserManagement")); |
||
188 | return !$headers || !in_array('HTTP/1.1 200 OK', $headers); |
||
|
|||
189 | } |
||
190 | |||
191 | /** |
||
192 | * Přidá listener na spravovaných vytvářených webových služeb. |
||
193 | * |
||
194 | * @param string $eventName |
||
195 | * @param callable $callback |
||
196 | */ |
||
197 | public function addWebServiceListener($eventName, callable $callback) |
||
204 | } |
||
205 |
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)
or! empty(...)
instead.