Complex classes like Parallels often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes. You can also have a look at the cohesion graph to spot any un-connected, or weakly-connected components.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Parallels, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
21 | class Parallels { |
||
22 | public $licenseType = 'billing'; // billing or purchase |
||
23 | private $xmlOptions = ['sslverify' => FALSE]; |
||
24 | private $defaultUrl = 'https://ka.parallels.com:7050/'; |
||
25 | private $defaultDemoUrl = 'https://kademo.parallels.com:7050/'; |
||
26 | public $url = ''; |
||
27 | public $response; |
||
28 | private $client = ''; |
||
29 | private $login = ''; |
||
30 | private $password = ''; |
||
31 | public $xml; |
||
32 | |||
33 | /** |
||
34 | * @param NULL|string $login api login, NULL(default) to use the PARALLELS_KA_LOGIN setting |
||
35 | * @param NULL|string $password api password, NULL(default) to use the PARALLELS_KA_PASSWORD setting |
||
36 | * @param NULL|string $client api client, NULL(default) to use the PARALLELS_KA_CLIENT setting |
||
37 | * @param bool $demo defaults to FALSE, whether or not to use the demo interface instae dof the normal one |
||
38 | * @param NULL|array $xmlOptions array of optoins ot pass to xmlrpc2 client |
||
39 | */ |
||
40 | public function __construct($login = NULL, $password = NULL, $client = NULL, $demo = FALSE, $xmlOptions = NULL) { |
||
|
|||
41 | if (null === $login && defined('PARALLELS_KA_LOGIN')) |
||
42 | $this->login = constant('PARALLELS_KA_LOGIN'); |
||
43 | else |
||
44 | $this->login = $login; |
||
45 | if (null === $password && defined('PARALLELS_KA_PASSWORD')) |
||
46 | $this->password = constant('PARALLELS_KA_PASSWORD'); |
||
47 | else |
||
48 | $this->password = $password; |
||
49 | if (null !== $client) |
||
50 | $this->client = $client; |
||
51 | elseif (defined('PARALLELS_KA_CLIENT')) |
||
52 | $this->client = constant('PARALLELS_KA_CLIENT'); |
||
53 | if ($demo === TRUE) |
||
54 | $this->url = $this->defaultDemoUrl; |
||
55 | elseif ($demo === FALSE) |
||
56 | $this->url = $this->defaultUrl; |
||
57 | else |
||
58 | $this->url = $demo; |
||
59 | if (null !== $xmlOptions) |
||
60 | $this->xmlOptions = $xmlOptions; |
||
61 | if (!isset($GLOBALS['HTTP_RAW_POST_DATA'])) |
||
62 | $GLOBALS['HTTP_RAW_POST_DATA'] = file_get_contents('php://input'); |
||
63 | require_once 'XML/RPC2/Client.php'; |
||
64 | $this->xml = \XML_RPC2_Client::create($this->url, $this->xmlOptions); |
||
65 | } |
||
66 | |||
67 | /** |
||
68 | * @return array |
||
69 | */ |
||
70 | 1 | public function authInfo() { |
|
71 | 1 | return ['login' => $this->login, 'password' => $this->password]; |
|
72 | } |
||
73 | |||
74 | /** |
||
75 | * @param array $ips |
||
76 | * @param array $macs |
||
77 | * @return array |
||
78 | */ |
||
79 | public function serverAddress($ips = [], $macs = []) { |
||
80 | if (!is_array($ips) && $ips != '') |
||
81 | $ips = [$ips]; |
||
82 | if (!is_array($macs) && $macs != '') |
||
83 | $macs = [$macs]; |
||
84 | return [ |
||
85 | 'ips' => $ips, |
||
86 | 'macs' => $macs |
||
87 | ]; |
||
88 | } |
||
89 | |||
90 | /** |
||
91 | * @param $key |
||
92 | * @return mixed |
||
93 | */ |
||
94 | public function terminateKey($key) { |
||
98 | |||
99 | /** |
||
100 | * @param $key |
||
101 | * @return mixed |
||
102 | */ |
||
103 | public function resetKey($key) { |
||
107 | |||
108 | /** |
||
109 | * @param $key |
||
110 | * @return mixed |
||
111 | */ |
||
112 | public function activateKey($key) { |
||
116 | |||
117 | /** |
||
118 | * @param $key |
||
119 | * @param $note |
||
120 | * @return mixed |
||
121 | */ |
||
122 | public function addNoteToKey($key, $note) { |
||
126 | |||
127 | /** |
||
128 | * @param $key |
||
129 | * @param bool $email |
||
130 | * @return mixed |
||
131 | */ |
||
132 | public function sendKeyByEmail($key, $email = FALSE) { |
||
133 | if ($email === FALSE) |
||
134 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key]); |
||
135 | else |
||
136 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key, $email]); |
||
137 | return $this->response; |
||
138 | } |
||
139 | |||
140 | /** |
||
141 | * @param $keyType |
||
142 | * @param array $upgradePlans |
||
143 | * @param array $ips |
||
144 | * @param array $macs |
||
145 | * @param bool $licenseType |
||
146 | * @param bool $client |
||
147 | * @return mixed |
||
148 | */ |
||
149 | public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = FALSE, $client = FALSE) { |
||
150 | if (!is_array($ips) && $ips != '') |
||
151 | $ips = [$ips]; |
||
152 | $this->response = $this->xml->__call('partner10.createKey', [ |
||
153 | $this->authInfo(), |
||
154 | $this->serverAddress($ips, $macs), $client === FALSE ? $this->client : $client, |
||
155 | $keyType, |
||
156 | $upgradePlans, $licenseType === FALSE ? $this->LicenseType : $licenseType |
||
157 | ] |
||
158 | ); |
||
159 | return $this->response; |
||
160 | /* Success: |
||
161 | Array |
||
162 | ( |
||
163 | [mainKeyNumber] => PLSK.00004266.0000 |
||
164 | [expirationDate] => stdClass Object |
||
165 | ( |
||
166 | [scalar] => 20131209T00:00:00 |
||
167 | [xmlrpc_type] => datetime |
||
168 | [timestamp] => 1386547200 |
||
169 | ) |
||
170 | |||
171 | [productKey] => DETAIN-2TVB02-ZT1R57-AY2442-6WN966 |
||
172 | [additionalKeysNumbers] => Array |
||
173 | ( |
||
174 | ) |
||
175 | |||
176 | [resultCode] => 100 |
||
177 | [resultDesc] => PLSK.00004266.0000 has been successfully created. |
||
178 | [updateDate] => stdClass Object |
||
179 | ( |
||
180 | [scalar] => 20131129T00:00:00 |
||
181 | [xmlrpc_type] => datetime |
||
182 | [timestamp] => 1385683200 |
||
183 | ) |
||
184 | |||
185 | ) |
||
186 | */ |
||
187 | } |
||
188 | |||
189 | /** |
||
190 | * @param $key |
||
191 | * @return mixed |
||
192 | */ |
||
193 | public function retrieveKey($key) { |
||
194 | $this->response = $this->xml->__call('partner10.retrieveKey', [$this->authInfo(), $key]); |
||
195 | return $this->response; |
||
196 | /* Success |
||
197 | Array |
||
198 | ( |
||
199 | [keyExtension] => xml |
||
200 | [resultCode] => 100 |
||
201 | [resultDesc] => PLSK.00005819.0000 has been successfully retrieved |
||
202 | [keyNumber] => PLSK.00005819.0000 |
||
203 | [key] => stdClass Object |
||
204 | ( |
||
205 | [scalar] => <?xml version="1.0" encoding="UTF-8"?><plesk-windows:key xmlns:plesk-windows="http://parallels.com/schemas/keys/products/plesk/windows/multi" core:format="openfusion-3" xmlns:core="http://parallels.com/schemas/keys/core/3"> |
||
206 | <!--Unique product Key number--> |
||
207 | <core:key-number core:type="string">PLSK.00005819</core:key-number> |
||
208 | <!--Key version--> |
||
209 | <core:key-version core:type="string">0000</core:key-version> |
||
210 | <!--Key description--> |
||
211 | <core:description> |
||
212 | <core:keytype>Parallels Plesk Panel 10.x/11.x and Later for Windows</core:keytype> |
||
213 | <core:feature>Unlimited Domains w/1 yr SUS</core:feature> |
||
214 | <core:feature>Parallels Web Presence Builder - 100 Sites</core:feature> |
||
215 | <core:feature>Parallels PowerPack for Plesk (Windows)</core:feature> |
||
216 | </core:description> |
||
217 | <!--Product which this license is intended to work on--> |
||
218 | <core:product core:type="string">plesk-win</core:product> |
||
219 | <!--Supported product version--> |
||
220 | <core:versions> |
||
221 | <core:from core:type="string">10.0</core:from> |
||
222 | <core:to core:type="string">any</core:to> |
||
223 | </core:versions> |
||
224 | <!--Date after which this license becomes usable (inclusive)--> |
||
225 | <core:start-date core:type="date">instant</core:start-date> |
||
226 | <!--Date before which this license is usable (exclusive)--> |
||
227 | <core:expiration-date core:type="date">2013-12-02</core:expiration-date> |
||
228 | <!--URL of the service endpoint to use when performing an autoupdate--> |
||
229 | <core:license-server-url core:type="string">https://ka.parallels.com:5224/xmlrpc</core:license-server-url> |
||
230 | <!--Date when product will try to perform an autoupdate--> |
||
231 | <core:update-date core:type="date">2013-11-22</core:update-date> |
||
232 | <core:update-ticket core:hidden="true" core:type="string">k0uj75wmlfa1a5hwmk-k43gy2ji0p2y1</core:update-ticket> |
||
233 | <!--Number of domains--> |
||
234 | <plesk-windows:domains core:type="integer">unlimited</plesk-windows:domains> |
||
235 | <!--Number of clients--> |
||
236 | <plesk-windows:clients core:type="integer">unlimited</plesk-windows:clients> |
||
237 | <!--Number of webusers--> |
||
238 | <plesk-windows:webusers core:type="integer">unlimited</plesk-windows:webusers> |
||
239 | <!--Number of mailnames--> |
||
240 | <plesk-windows:mailnames core:type="integer">unlimited</plesk-windows:mailnames> |
||
241 | <!--Number of additional language pack(s)--> |
||
242 | <plesk-windows:language-packs core:type="integer">0</plesk-windows:language-packs> |
||
243 | <plesk-windows:mpc-id core:hidden="true" core:type="integer">0</plesk-windows:mpc-id> |
||
244 | <plesk-windows:mpc-disabled core:hidden="true" core:type="boolean">false</plesk-windows:mpc-disabled> |
||
245 | <!--Google tools--> |
||
246 | <plesk-windows:google-tools core:type="boolean">true</plesk-windows:google-tools> |
||
247 | <plesk-windows:mpc-mng-disabled core:hidden="true" core:type="boolean">false</plesk-windows:mpc-mng-disabled> |
||
248 | <!--Number of slaves--> |
||
249 | <plesk-windows:slaves core:type="integer">0</plesk-windows:slaves> |
||
250 | <!--EventManager--> |
||
251 | <plesk-windows:event-manager core:type="boolean">true</plesk-windows:event-manager> |
||
252 | <!--Domains backup--> |
||
253 | <plesk-windows:domains-backup core:type="boolean">true</plesk-windows:domains-backup> |
||
254 | <!--Tomcat support--> |
||
255 | <plesk-windows:tomcat-support core:type="boolean">true</plesk-windows:tomcat-support> |
||
256 | <!--Subdomains--> |
||
257 | <plesk-windows:subdomains-support core:type="boolean">true</plesk-windows:subdomains-support> |
||
258 | <!--Backward key compatibility restriction--> |
||
259 | <plesk-windows:backward-restriction core:type="integer">0</plesk-windows:backward-restriction> |
||
260 | <!--Work Inside Virtuozzo--> |
||
261 | <plesk-windows:vps-only core:type="boolean">false</plesk-windows:vps-only> |
||
262 | <!--Work Inside Hyper-V--> |
||
263 | <plesk-windows:hyper-v core:type="boolean">false</plesk-windows:hyper-v> |
||
264 | <!--Work Inside VMware--> |
||
265 | <plesk-windows:vmware core:type="boolean">false</plesk-windows:vmware> |
||
266 | <!--Work Inside Xen--> |
||
267 | <plesk-windows:xen core:type="boolean">false</plesk-windows:xen> |
||
268 | <!--Work Inside KVM--> |
||
269 | <plesk-windows:kvm core:type="boolean">false</plesk-windows:kvm> |
||
270 | <!--Work Inside Parallels Hypervisor--> |
||
271 | <plesk-windows:hypervisor core:type="boolean">false</plesk-windows:hypervisor> |
||
272 | <!--Global changes--> |
||
273 | <plesk-windows:global-changes core:type="boolean">true</plesk-windows:global-changes> |
||
274 | <!--Shell access--> |
||
275 | <plesk-windows:shell-access core:type="boolean">true</plesk-windows:shell-access> |
||
276 | <!--Detailed traffic--> |
||
277 | <plesk-windows:detailed-traffic core:type="boolean">true</plesk-windows:detailed-traffic> |
||
278 | <!--Notification manager--> |
||
279 | <plesk-windows:notification-manager core:type="boolean">true</plesk-windows:notification-manager> |
||
280 | <!--Action log manager--> |
||
281 | <plesk-windows:action-manager core:type="boolean">true</plesk-windows:action-manager> |
||
282 | <!--Clients and Domains Expirations management--> |
||
283 | <plesk-windows:expirations-manager core:type="boolean">true</plesk-windows:expirations-manager> |
||
284 | <!--Client templates--> |
||
285 | <plesk-windows:client-templates core:type="boolean">true</plesk-windows:client-templates> |
||
286 | <!--Ability to use Application Vault--> |
||
287 | <plesk-windows:appvault-support core:type="boolean">true</plesk-windows:appvault-support> |
||
288 | <!--Ability to use SpamAssassin--> |
||
289 | <plesk-windows:spamassasin-support core:type="boolean">true</plesk-windows:spamassasin-support> |
||
290 | <!--Ability to use Trouble Ticketing System--> |
||
291 | <plesk-windows:tts-support core:type="boolean">true</plesk-windows:tts-support> |
||
292 | <!--Ability to use ColdFusion--> |
||
293 | <plesk-windows:coldfusion-support core:type="boolean">true</plesk-windows:coldfusion-support> |
||
294 | <plesk-windows:ask-update core:hidden="true" core:type="boolean">false</plesk-windows:ask-update> |
||
295 | <plesk-windows:autoinstaller-config core:hidden="true" core:type="string">true</plesk-windows:autoinstaller-config> |
||
296 | <!--Ability to use DrWeb--> |
||
297 | <plesk-windows:drweb-support core:type="boolean">true</plesk-windows:drweb-support> |
||
298 | <plesk-windows:store-id core:hidden="true" core:type="integer">1</plesk-windows:store-id> |
||
299 | <!--Ability to use Migration Manager--> |
||
300 | <plesk-windows:migration-manager core:type="boolean">true</plesk-windows:migration-manager> |
||
301 | <!--Ability to use MS SQL--> |
||
302 | <plesk-windows:mssql core:type="boolean">true</plesk-windows:mssql> |
||
303 | <!--Allowed locales--> |
||
304 | <plesk-windows:allowed-locales core:type="string">any</plesk-windows:allowed-locales> |
||
305 | <!--Allows feature upgrades for this version--> |
||
306 | <plesk-windows:feature-upgrades core:type="boolean">true</plesk-windows:feature-upgrades> |
||
307 | <!--Parallels Plesk Billing accounts count--> |
||
308 | <plesk-windows:modernbill-accounts core:type="integer">0</plesk-windows:modernbill-accounts> |
||
309 | <!--Number of sites--> |
||
310 | <plesk-windows:sitebuilder-sites core:type="integer">100</plesk-windows:sitebuilder-sites> |
||
311 | <!--Enable Parallels Plesk Mobile Server Manager--> |
||
312 | <plesk-windows:mobile-server-manager-support core:type="boolean">true</plesk-windows:mobile-server-manager-support> |
||
313 | <ds:Signature xmlns:ds="http://www.w3.org/2000/09/xmldsig#"> |
||
314 | <ds:SignedInfo> |
||
315 | <ds:CanonicalizationMethod Algorithm="http://parallels.com/schemas/keys/core/3#canonicalize"/> |
||
316 | <ds:SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> |
||
317 | <ds:Reference URI=""> |
||
318 | <ds:Transforms> |
||
319 | <ds:Transform Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315#WithComments"/> |
||
320 | <ds:Transform Algorithm="http://parallels.com/schemas/keys/core/3#transform"/> |
||
321 | </ds:Transforms> |
||
322 | <ds:DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/> |
||
323 | <ds:DigestValue>ENCODED HASH HERE</ds:DigestValue> |
||
324 | </ds:Reference> |
||
325 | </ds:SignedInfo> |
||
326 | <ds:SignatureValue> |
||
327 | ENCODED DATA HERE |
||
328 | </ds:SignatureValue> |
||
329 | <ds:KeyInfo> |
||
330 | <ds:X509Data> |
||
331 | <ds:X509Certificate> |
||
332 | ENCODED DATA HERE |
||
333 | </ds:X509Certificate> |
||
334 | </ds:X509Data> |
||
335 | </ds:KeyInfo> |
||
336 | </ds:Signature> |
||
337 | </plesk-windows:key> |
||
338 | |||
339 | [xmlrpc_type] => base64 |
||
340 | ) |
||
341 | |||
342 | ) |
||
343 | |||
344 | */ |
||
345 | } |
||
346 | |||
347 | /** |
||
348 | * Returns an array with keys 'resultCode', 'resultDesc', and 'upgradePlans'. the last one being an array of plan names, one time i wrote down the output it looked like: |
||
349 | * 3_LANGUAGE_PACKS FOTOLIA_OFF 5_LANGUAGE_PACKS NEWSFEED_OFF VIRTUOZZO_PROMO_OFF ADDITIONAL_LANGUAGE_PACK were some of the packqage types, there wer eothers |
||
350 | * |
||
351 | * @param $key |
||
352 | * @return mixed |
||
353 | */ |
||
354 | public function getAvailableUpgrades($key) { |
||
355 | $this->response = $this->xml->__call('partner10.getAvailableUpgrades', [$this->authInfo(), $key]); |
||
356 | return $this->response; |
||
357 | } |
||
358 | |||
359 | /** |
||
360 | * Success |
||
361 | * Array |
||
362 | * ( |
||
363 | * [keyInfo] => Array |
||
364 | * ( |
||
365 | * [expirationDate] => stdClass Object |
||
366 | * ( |
||
367 | * [scalar] => 20131202T00:00:00 |
||
368 | * [xmlrpc_type] => datetime |
||
369 | * [timestamp] => 1385942400 |
||
370 | * ) |
||
371 | * ) |
||
372 | * [features] => Array |
||
373 | * ( |
||
374 | * [0] => Array |
||
375 | * ( |
||
376 | * [apiName] => PLESK_7X_FOR_WIN_POWER_PACK |
||
377 | * [name] => Parallels PowerPack for Plesk (Windows) (Monthly Lease) |
||
378 | * ) |
||
379 | * [1] => Array |
||
380 | * ( |
||
381 | * [apiName] => PLESK-100-SITES |
||
382 | * [name] => Parallels Web Presence Builder - 100 Sites (Monthly Lease) |
||
383 | * ) |
||
384 | * [2] => Array |
||
385 | * ( |
||
386 | * [apiName] => UNLIMITED_DOMAINS |
||
387 | * [name] => Unlimited Domains w/1 yr SUS (Lease) |
||
388 | * ) |
||
389 | * ) |
||
390 | * [billingType] => LEASE |
||
391 | * [productFamily] => plesk |
||
392 | * [createDate] => stdClass Object |
||
393 | * ( |
||
394 | * [scalar] => 20131023T18:02:11 |
||
395 | * [xmlrpc_type] => datetime |
||
396 | * [timestamp] => 1382551331 |
||
397 | * ) |
||
398 | * [trial] => |
||
399 | * [lastReportingDate] => stdClass Object |
||
400 | * ( |
||
401 | * [scalar] => 20131029T06:27:31 |
||
402 | * [xmlrpc_type] => datetime |
||
403 | * [timestamp] => 1383028051 |
||
404 | * ) |
||
405 | * [additionalKeys] => Array |
||
406 | * ( |
||
407 | * [0] => Array |
||
408 | * ( |
||
409 | * [expirationDate] => stdClass Object |
||
410 | * ( |
||
411 | * [scalar] => 20131202T00:00:00 |
||
412 | * [xmlrpc_type] => datetime |
||
413 | * [timestamp] => 1385942400 |
||
414 | * ) |
||
415 | * [lastReportingIp] => 206.72.205.242, 206.72.205.243, 206.72.205.244, 206.72.205.245, 206.72.205.246 |
||
416 | * [apiKeyType] => N/A |
||
417 | * [boundIPAddress] => |
||
418 | * [problem] => |
||
419 | * [keyNumber] => KAV.00005821.0001 |
||
420 | * [properties] => Array |
||
421 | * ( |
||
422 | * ) |
||
423 | * [type] => ADDITIONAL |
||
424 | * [updateDate] => stdClass Object |
||
425 | * ( |
||
426 | * [scalar] => 20131122T00:00:00 |
||
427 | * [xmlrpc_type] => datetime |
||
428 | * [timestamp] => 1385078400 |
||
429 | * ) |
||
430 | * [clientId] => 19282468 |
||
431 | * [parentKeyNumber] => PLSK.00005819.0000 |
||
432 | * [lastReportingVersion] => 11.5.3 |
||
433 | * [keyType] => Parallels Plesk Panel Antivirus Powered by Kaspersky, 5 Mailboxes (Parallels PowerPack for Plesk) (Windows) (Monthly Lease) |
||
434 | * [terminated] => |
||
435 | * [susAndSupportInfo] => Array |
||
436 | * ( |
||
437 | * ) |
||
438 | * [features] => Array |
||
439 | * ( |
||
440 | * ) |
||
441 | * [billingType] => LEASE |
||
442 | * [productFamily] => kav |
||
443 | * [createDate] => stdClass Object |
||
444 | * ( |
||
445 | * [scalar] => 20131023T18:02:12 |
||
446 | * [xmlrpc_type] => datetime |
||
447 | * [timestamp] => 1382551332 |
||
448 | * ) |
||
449 | * [trial] => |
||
450 | * [lastReportingDate] => stdClass Object |
||
451 | * ( |
||
452 | * [scalar] => 20131023T18:05:24 |
||
453 | * [xmlrpc_type] => datetime |
||
454 | * [timestamp] => 1382551524 |
||
455 | * ) |
||
456 | * [additionalKeys] => Array |
||
457 | * ( |
||
458 | * ) |
||
459 | * ) |
||
460 | * [1] => Array |
||
461 | * ( |
||
462 | * [expirationDate] => stdClass Object |
||
463 | * ( |
||
464 | * [scalar] => 20131202T00:00:00 |
||
465 | * [xmlrpc_type] => datetime |
||
466 | * [timestamp] => 1385942400 |
||
467 | * ) |
||
468 | * [lastReportingIp] => 206.72.205.242, 206.72.205.243, 206.72.205.244, 206.72.205.245, 206.72.205.246 |
||
469 | * [apiKeyType] => N/A |
||
470 | * [boundIPAddress] => |
||
471 | * [problem] => |
||
472 | * [keyNumber] => APS.00005820.0001 |
||
473 | * [properties] => Array |
||
474 | * ( |
||
475 | * ) |
||
476 | * [type] => ADDITIONAL |
||
477 | * [updateDate] => stdClass Object |
||
478 | * ( |
||
479 | * [scalar] => 20131122T00:00:00 |
||
480 | * [xmlrpc_type] => datetime |
||
481 | * [timestamp] => 1385078400 |
||
482 | * ) |
||
483 | * [clientId] => 19282468 |
||
484 | * [parentKeyNumber] => PLSK.00005819.0000 |
||
485 | * [lastReportingVersion] => 11.5.3 |
||
486 | * [keyType] => UNITY One, 2 Domains (Parallels PowerPack for Plesk) (Windows) (Monthly Lease) |
||
487 | * [terminated] => |
||
488 | * [susAndSupportInfo] => Array |
||
489 | * ( |
||
490 | * ) |
||
491 | * [features] => Array |
||
492 | * ( |
||
493 | * ) |
||
494 | * [billingType] => LEASE |
||
495 | * [productFamily] => unity-one |
||
496 | * [createDate] => stdClass Object |
||
497 | * ( |
||
498 | * [scalar] => 20131023T18:02:11 |
||
499 | * [xmlrpc_type] => datetime |
||
500 | * [timestamp] => 1382551331 |
||
501 | * ) |
||
502 | * [trial] => |
||
503 | * [lastReportingDate] => stdClass Object |
||
504 | * ( |
||
505 | * [scalar] => 20131023T18:05:26 |
||
506 | * [xmlrpc_type] => datetime |
||
507 | * [timestamp] => 1382551526 |
||
508 | * ) |
||
509 | * [additionalKeys] => Array |
||
510 | * ( |
||
511 | * ) |
||
512 | * ) |
||
513 | * ) |
||
514 | * ) |
||
515 | *[resultCode] => 100 |
||
516 | * [resultDesc] => Key info for PLSK.00005819.0000 key returned successfully |
||
517 | * [keyNumber] => PLSK.00005819.0000 |
||
518 | * ) |
||
519 | * |
||
520 | * @param $key |
||
521 | * @return mixed |
||
522 | */ |
||
523 | public function getKeyInfo($key) { |
||
524 | $this->response = $this->xml->__call('partner10.getKeyInfo', [$this->authInfo(), $key]); |
||
525 | return $this->response; |
||
526 | } |
||
527 | |||
528 | /** |
||
529 | * @param string $ipAddress the ip address |
||
530 | * @return false|string false if no key , or a string w/ the key |
||
531 | */ |
||
532 | public function getMainKeyFromIp($ipAddress) { |
||
548 | |||
549 | /** |
||
550 | * @param $ipAddress |
||
551 | * @return mixed |
||
552 | */ |
||
553 | public function getKeysInfoByIP($ipAddress) { |
||
554 | $this->response = $this->xml->__call('partner10.getKeysInfoByIP', [$this->authInfo(), $ipAddress]); |
||
555 | return $this->response; |
||
556 | } |
||
557 | |||
558 | /** |
||
559 | * @param array|string $ips |
||
560 | * @param array $macs |
||
561 | * @return mixed |
||
562 | */ |
||
563 | public function getKeyNumbers($ips = [], $macs = []) { |
||
687 | |||
688 | /** |
||
689 | * @param bool $client |
||
690 | * @return mixed |
||
691 | */ |
||
692 | public function getAvailableKeyTypesAndFeatures($client = FALSE) { |
||
1002 | |||
1003 | } |
||
1004 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: