@@ -21,8 +21,7 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @access public |
| 23 | 23 | */ |
| 24 | -class Parallels |
|
| 25 | -{ |
|
| 24 | +class Parallels { |
|
| 26 | 25 | public $licenseType = 'billing'; // billing or purchase |
| 27 | 26 | private $xmlOptions = ['sslverify' => false]; |
| 28 | 27 | private $defaultUrl = 'https://ka.parallels.com:7050/'; |
@@ -41,8 +40,7 @@ discard block |
||
| 41 | 40 | * @param bool $demo defaults to FALSE, whether or not to use the demo interface instae dof the normal one |
| 42 | 41 | * @param NULL|array $xmlOptions array of optoins ot pass to xmlrpc2 client |
| 43 | 42 | */ |
| 44 | - public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null) |
|
| 45 | - { |
|
| 43 | + public function __construct($login = null, $password = null, $client = null, $demo = false, $xmlOptions = null) { |
|
| 46 | 44 | if (null === $login && defined('PARALLELS_KA_LOGIN')) { |
| 47 | 45 | $this->login = constant('PARALLELS_KA_LOGIN'); |
| 48 | 46 | } else { |
@@ -75,8 +73,7 @@ discard block |
||
| 75 | 73 | /** |
| 76 | 74 | * @return array |
| 77 | 75 | */ |
| 78 | - public function authInfo() |
|
| 79 | - { |
|
| 76 | + public function authInfo() { |
|
| 80 | 77 | return ['login' => $this->login, 'password' => $this->password]; |
| 81 | 78 | } |
| 82 | 79 | |
@@ -85,8 +82,7 @@ discard block |
||
| 85 | 82 | * @param array $macs |
| 86 | 83 | * @return array |
| 87 | 84 | */ |
| 88 | - public function serverAddress($ips = [], $macs = []) |
|
| 89 | - { |
|
| 85 | + public function serverAddress($ips = [], $macs = []) { |
|
| 90 | 86 | if (!is_array($ips) && $ips != '') { |
| 91 | 87 | $ips = [$ips]; |
| 92 | 88 | } |
@@ -103,8 +99,7 @@ discard block |
||
| 103 | 99 | * @param $key |
| 104 | 100 | * @return mixed |
| 105 | 101 | */ |
| 106 | - public function terminateKey($key) |
|
| 107 | - { |
|
| 102 | + public function terminateKey($key) { |
|
| 108 | 103 | \StatisticClient::tick('Parallels', 'terminateKey'); |
| 109 | 104 | $this->response = $this->xml->__call('partner10.terminateKey', [$this->authInfo(), $key]); |
| 110 | 105 | if ($this->response === false) { |
@@ -119,8 +114,7 @@ discard block |
||
| 119 | 114 | * @param $key |
| 120 | 115 | * @return mixed |
| 121 | 116 | */ |
| 122 | - public function resetKey($key) |
|
| 123 | - { |
|
| 117 | + public function resetKey($key) { |
|
| 124 | 118 | \StatisticClient::tick('Parallels', 'resetKey'); |
| 125 | 119 | $this->response = $this->xml->__call('partner10.resetKey', [$this->authInfo(), $key]); |
| 126 | 120 | if ($this->response === false) { |
@@ -135,8 +129,7 @@ discard block |
||
| 135 | 129 | * @param $key |
| 136 | 130 | * @return mixed |
| 137 | 131 | */ |
| 138 | - public function activateKey($key) |
|
| 139 | - { |
|
| 132 | + public function activateKey($key) { |
|
| 140 | 133 | \StatisticClient::tick('Parallels', 'activateKey'); |
| 141 | 134 | $this->response = $this->xml->__call('partner10.activateKey', [$this->authInfo(), $key]); |
| 142 | 135 | if ($this->response === false) { |
@@ -152,8 +145,7 @@ discard block |
||
| 152 | 145 | * @param $note |
| 153 | 146 | * @return mixed |
| 154 | 147 | */ |
| 155 | - public function addNoteToKey($key, $note) |
|
| 156 | - { |
|
| 148 | + public function addNoteToKey($key, $note) { |
|
| 157 | 149 | \StatisticClient::tick('Parallels', 'addNoteToKey'); |
| 158 | 150 | $this->response = $this->xml->__call('partner10.addNoteToKey', [$this->authInfo(), $key, $note]); |
| 159 | 151 | if ($this->response === false) { |
@@ -169,8 +161,7 @@ discard block |
||
| 169 | 161 | * @param bool $email |
| 170 | 162 | * @return mixed |
| 171 | 163 | */ |
| 172 | - public function sendKeyByEmail($key, $email = false) |
|
| 173 | - { |
|
| 164 | + public function sendKeyByEmail($key, $email = false) { |
|
| 174 | 165 | \StatisticClient::tick('Parallels', 'sendKeyByEmail'); |
| 175 | 166 | if ($email === false) { |
| 176 | 167 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key]); |
@@ -194,8 +185,7 @@ discard block |
||
| 194 | 185 | * @param bool $client |
| 195 | 186 | * @return mixed |
| 196 | 187 | */ |
| 197 | - public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false) |
|
| 198 | - { |
|
| 188 | + public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false) { |
|
| 199 | 189 | if (!is_array($ips) && $ips != '') { |
| 200 | 190 | $ips = [$ips]; |
| 201 | 191 | } |
@@ -248,8 +238,7 @@ discard block |
||
| 248 | 238 | * @param $key |
| 249 | 239 | * @return mixed |
| 250 | 240 | */ |
| 251 | - public function retrieveKey($key) |
|
| 252 | - { |
|
| 241 | + public function retrieveKey($key) { |
|
| 253 | 242 | \StatisticClient::tick('Parallels', 'retrieveKey'); |
| 254 | 243 | $this->response = $this->xml->__call('partner10.retrieveKey', [$this->authInfo(), $key]); |
| 255 | 244 | if ($this->response === false) { |
@@ -416,8 +405,7 @@ discard block |
||
| 416 | 405 | * @param $key |
| 417 | 406 | * @return mixed |
| 418 | 407 | */ |
| 419 | - public function getAvailableUpgrades($key) |
|
| 420 | - { |
|
| 408 | + public function getAvailableUpgrades($key) { |
|
| 421 | 409 | \StatisticClient::tick('Parallels', 'getAvailableUpgrades'); |
| 422 | 410 | $this->response = $this->xml->__call('partner10.getAvailableUpgrades', [$this->authInfo(), $key]); |
| 423 | 411 | if ($this->response === false) { |
@@ -592,8 +580,7 @@ discard block |
||
| 592 | 580 | * @param $key |
| 593 | 581 | * @return mixed |
| 594 | 582 | */ |
| 595 | - public function getKeyInfo($key) |
|
| 596 | - { |
|
| 583 | + public function getKeyInfo($key) { |
|
| 597 | 584 | \StatisticClient::tick('Parallels', 'getKeyInfo'); |
| 598 | 585 | $this->response = $this->xml->__call('partner10.getKeyInfo', [$this->authInfo(), $key]); |
| 599 | 586 | if ($this->response === false) { |
@@ -608,8 +595,7 @@ discard block |
||
| 608 | 595 | * @param string $ipAddress the ip address |
| 609 | 596 | * @return false|string false if no key , or a string w/ the key |
| 610 | 597 | */ |
| 611 | - public function getMainKeyFromIp($ipAddress) |
|
| 612 | - { |
|
| 598 | + public function getMainKeyFromIp($ipAddress) { |
|
| 613 | 599 | $response = $this->getKeyNumbers($ipAddress); |
| 614 | 600 | //$response = $this->getKeysInfoByIP($ipAddress); |
| 615 | 601 | $return = false; |
@@ -633,8 +619,7 @@ discard block |
||
| 633 | 619 | * @param $ipAddress |
| 634 | 620 | * @return mixed |
| 635 | 621 | */ |
| 636 | - public function getKeysInfoByIP($ipAddress) |
|
| 637 | - { |
|
| 622 | + public function getKeysInfoByIP($ipAddress) { |
|
| 638 | 623 | \StatisticClient::tick('Parallels', 'getKeysInfoByIP'); |
| 639 | 624 | $this->response = $this->xml->__call('partner10.getKeysInfoByIP', [$this->authInfo(), $ipAddress]); |
| 640 | 625 | if ($this->response === false) { |
@@ -650,8 +635,7 @@ discard block |
||
| 650 | 635 | * @param array $macs |
| 651 | 636 | * @return mixed |
| 652 | 637 | */ |
| 653 | - public function getKeyNumbers($ips = [], $macs = []) |
|
| 654 | - { |
|
| 638 | + public function getKeyNumbers($ips = [], $macs = []) { |
|
| 655 | 639 | myadmin_log('licenses', 'info', json_encode($this->serverAddress($ips, $macs)), __LINE__, __FILE__); |
| 656 | 640 | \StatisticClient::tick('Parallels', 'getKeyNumbers'); |
| 657 | 641 | $this->response = $this->xml->__call('partner10.getKeyNumbers', [$this->authInfo(), $this->serverAddress($ips, $macs)]); |
@@ -786,8 +770,7 @@ discard block |
||
| 786 | 770 | * @param bool $client |
| 787 | 771 | * @return mixed |
| 788 | 772 | */ |
| 789 | - public function getAvailableKeyTypesAndFeatures($client = false) |
|
| 790 | - { |
|
| 773 | + public function getAvailableKeyTypesAndFeatures($client = false) { |
|
| 791 | 774 | \StatisticClient::tick('Parallels', 'getAvailableKeyTypesAndFeatures'); |
| 792 | 775 | $this->response = $this->xml->__call('partner10.getAvailableKeyTypesAndFeatures', [$this->authInfo(), $client === false ? $this->client : $client]); |
| 793 | 776 | if ($this->response === false) { |