@@ -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) |
@@ -118,8 +113,7 @@ discard block |
||
| 118 | 113 | * @param $key |
| 119 | 114 | * @return mixed |
| 120 | 115 | */ |
| 121 | - public function resetKey($key) |
|
| 122 | - { |
|
| 116 | + public function resetKey($key) { |
|
| 123 | 117 | \StatisticClient::tick('Parallels', 'resetKey'); |
| 124 | 118 | $this->response = $this->xml->__call('partner10.resetKey', [$this->authInfo(), $key]); |
| 125 | 119 | if ($this->response === false) |
@@ -133,8 +127,7 @@ discard block |
||
| 133 | 127 | * @param $key |
| 134 | 128 | * @return mixed |
| 135 | 129 | */ |
| 136 | - public function activateKey($key) |
|
| 137 | - { |
|
| 130 | + public function activateKey($key) { |
|
| 138 | 131 | \StatisticClient::tick('Parallels', 'activateKey'); |
| 139 | 132 | $this->response = $this->xml->__call('partner10.activateKey', [$this->authInfo(), $key]); |
| 140 | 133 | if ($this->response === false) |
@@ -149,8 +142,7 @@ discard block |
||
| 149 | 142 | * @param $note |
| 150 | 143 | * @return mixed |
| 151 | 144 | */ |
| 152 | - public function addNoteToKey($key, $note) |
|
| 153 | - { |
|
| 145 | + public function addNoteToKey($key, $note) { |
|
| 154 | 146 | \StatisticClient::tick('Parallels', 'addNoteToKey'); |
| 155 | 147 | $this->response = $this->xml->__call('partner10.addNoteToKey', [$this->authInfo(), $key, $note]); |
| 156 | 148 | if ($this->response === false) |
@@ -165,8 +157,7 @@ discard block |
||
| 165 | 157 | * @param bool $email |
| 166 | 158 | * @return mixed |
| 167 | 159 | */ |
| 168 | - public function sendKeyByEmail($key, $email = false) |
|
| 169 | - { |
|
| 160 | + public function sendKeyByEmail($key, $email = false) { |
|
| 170 | 161 | \StatisticClient::tick('Parallels', 'sendKeyByEmail'); |
| 171 | 162 | if ($email === false) { |
| 172 | 163 | $this->response = $this->xml->__call('partner10.sendKeyByEmail', [$this->authInfo(), $key]); |
@@ -189,8 +180,7 @@ discard block |
||
| 189 | 180 | * @param bool $client |
| 190 | 181 | * @return mixed |
| 191 | 182 | */ |
| 192 | - public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false) |
|
| 193 | - { |
|
| 183 | + public function createKey($keyType, $upgradePlans = [], $ips = [], $macs = [], $licenseType = false, $client = false) { |
|
| 194 | 184 | if (!is_array($ips) && $ips != '') { |
| 195 | 185 | $ips = [$ips]; |
| 196 | 186 | } |
@@ -240,8 +230,7 @@ discard block |
||
| 240 | 230 | * @param $key |
| 241 | 231 | * @return mixed |
| 242 | 232 | */ |
| 243 | - public function retrieveKey($key) |
|
| 244 | - { |
|
| 233 | + public function retrieveKey($key) { |
|
| 245 | 234 | \StatisticClient::tick('Parallels', 'retrieveKey'); |
| 246 | 235 | $this->response = $this->xml->__call('partner10.retrieveKey', [$this->authInfo(), $key]); |
| 247 | 236 | if ($this->response === false) |
@@ -407,8 +396,7 @@ discard block |
||
| 407 | 396 | * @param $key |
| 408 | 397 | * @return mixed |
| 409 | 398 | */ |
| 410 | - public function getAvailableUpgrades($key) |
|
| 411 | - { |
|
| 399 | + public function getAvailableUpgrades($key) { |
|
| 412 | 400 | \StatisticClient::tick('Parallels', 'getAvailableUpgrades'); |
| 413 | 401 | $this->response = $this->xml->__call('partner10.getAvailableUpgrades', [$this->authInfo(), $key]); |
| 414 | 402 | if ($this->response === false) |
@@ -582,8 +570,7 @@ discard block |
||
| 582 | 570 | * @param $key |
| 583 | 571 | * @return mixed |
| 584 | 572 | */ |
| 585 | - public function getKeyInfo($key) |
|
| 586 | - { |
|
| 573 | + public function getKeyInfo($key) { |
|
| 587 | 574 | \StatisticClient::tick('Parallels', 'getKeyInfo'); |
| 588 | 575 | $this->response = $this->xml->__call('partner10.getKeyInfo', [$this->authInfo(), $key]); |
| 589 | 576 | if ($this->response === false) |
@@ -597,8 +584,7 @@ discard block |
||
| 597 | 584 | * @param string $ipAddress the ip address |
| 598 | 585 | * @return false|string false if no key , or a string w/ the key |
| 599 | 586 | */ |
| 600 | - public function getMainKeyFromIp($ipAddress) |
|
| 601 | - { |
|
| 587 | + public function getMainKeyFromIp($ipAddress) { |
|
| 602 | 588 | $response = $this->getKeyNumbers($ipAddress); |
| 603 | 589 | //$response = $this->getKeysInfoByIP($ipAddress); |
| 604 | 590 | $return = false; |
@@ -622,8 +608,7 @@ discard block |
||
| 622 | 608 | * @param $ipAddress |
| 623 | 609 | * @return mixed |
| 624 | 610 | */ |
| 625 | - public function getKeysInfoByIP($ipAddress) |
|
| 626 | - { |
|
| 611 | + public function getKeysInfoByIP($ipAddress) { |
|
| 627 | 612 | \StatisticClient::tick('Parallels', 'getKeysInfoByIP'); |
| 628 | 613 | $this->response = $this->xml->__call('partner10.getKeysInfoByIP', [$this->authInfo(), $ipAddress]); |
| 629 | 614 | if ($this->response === false) |
@@ -638,8 +623,7 @@ discard block |
||
| 638 | 623 | * @param array $macs |
| 639 | 624 | * @return mixed |
| 640 | 625 | */ |
| 641 | - public function getKeyNumbers($ips = [], $macs = []) |
|
| 642 | - { |
|
| 626 | + public function getKeyNumbers($ips = [], $macs = []) { |
|
| 643 | 627 | myadmin_log('licenses', 'info', json_encode($this->serverAddress($ips, $macs)), __LINE__, __FILE__); |
| 644 | 628 | \StatisticClient::tick('Parallels', 'getKeyNumbers'); |
| 645 | 629 | $this->response = $this->xml->__call('partner10.getKeyNumbers', [$this->authInfo(), $this->serverAddress($ips, $macs)]); |
@@ -773,8 +757,7 @@ discard block |
||
| 773 | 757 | * @param bool $client |
| 774 | 758 | * @return mixed |
| 775 | 759 | */ |
| 776 | - public function getAvailableKeyTypesAndFeatures($client = false) |
|
| 777 | - { |
|
| 760 | + public function getAvailableKeyTypesAndFeatures($client = false) { |
|
| 778 | 761 | \StatisticClient::tick('Parallels', 'getAvailableKeyTypesAndFeatures'); |
| 779 | 762 | $this->response = $this->xml->__call('partner10.getAvailableKeyTypesAndFeatures', [$this->authInfo(), $client === false ? $this->client : $client]); |
| 780 | 763 | if ($this->response === false) |