| @@ 7-56 (lines=50) @@ | ||
| 4 | namespace PleskX\Api\Operator; |
|
| 5 | use PleskX\Api\Struct\Customer as Struct; |
|
| 6 | ||
| 7 | class Customer extends \PleskX\Api\Operator |
|
| 8 | { |
|
| 9 | ||
| 10 | /** |
|
| 11 | * @param array $properties |
|
| 12 | * @return Struct\Info |
|
| 13 | */ |
|
| 14 | public function create($properties) |
|
| 15 | { |
|
| 16 | $packet = $this->_client->getPacket(); |
|
| 17 | $info = $packet->addChild($this->_wrapperTag)->addChild('add')->addChild('gen_info'); |
|
| 18 | ||
| 19 | foreach ($properties as $name => $value) { |
|
| 20 | $info->addChild($name, $value); |
|
| 21 | } |
|
| 22 | ||
| 23 | $response = $this->_client->request($packet); |
|
| 24 | return new Struct\Info($response); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @param string $field |
|
| 29 | * @param integer|string $value |
|
| 30 | * @return bool |
|
| 31 | */ |
|
| 32 | public function delete($field, $value) |
|
| 33 | { |
|
| 34 | return $this->_delete($field, $value); |
|
| 35 | } |
|
| 36 | ||
| 37 | /** |
|
| 38 | * @param string $field |
|
| 39 | * @param integer|string $value |
|
| 40 | * @return Struct\GeneralInfo |
|
| 41 | */ |
|
| 42 | public function get($field, $value) |
|
| 43 | { |
|
| 44 | $items = $this->_getItems(Struct\GeneralInfo::class, 'gen_info', $field, $value); |
|
| 45 | return reset($items); |
|
| 46 | } |
|
| 47 | ||
| 48 | /** |
|
| 49 | * @return Struct\GeneralInfo[] |
|
| 50 | */ |
|
| 51 | public function getAll() |
|
| 52 | { |
|
| 53 | return $this->_getItems(Struct\GeneralInfo::class, 'gen_info'); |
|
| 54 | } |
|
| 55 | ||
| 56 | } |
|
| 57 | ||
| @@ 7-59 (lines=53) @@ | ||
| 4 | namespace PleskX\Api\Operator; |
|
| 5 | use PleskX\Api\Struct\Reseller as Struct; |
|
| 6 | ||
| 7 | class Reseller extends \PleskX\Api\Operator |
|
| 8 | { |
|
| 9 | ||
| 10 | /** |
|
| 11 | * @param array $properties |
|
| 12 | * @return Struct\Info |
|
| 13 | */ |
|
| 14 | public function create($properties) |
|
| 15 | { |
|
| 16 | $packet = $this->_client->getPacket(); |
|
| 17 | $info = $packet->addChild($this->_wrapperTag)->addChild('add')->addChild('gen-info'); |
|
| 18 | ||
| 19 | foreach ($properties as $name => $value) { |
|
| 20 | $info->addChild($name, $value); |
|
| 21 | } |
|
| 22 | ||
| 23 | $response = $this->_client->request($packet); |
|
| 24 | return new Struct\Info($response); |
|
| 25 | } |
|
| 26 | ||
| 27 | /** |
|
| 28 | * @param string $field |
|
| 29 | * @param integer|string $value |
|
| 30 | * @return bool |
|
| 31 | */ |
|
| 32 | public function delete($field, $value) |
|
| 33 | { |
|
| 34 | return $this->_delete($field, $value); |
|
| 35 | } |
|
| 36 | ||
| 37 | ||
| 38 | /** |
|
| 39 | * @param string $field |
|
| 40 | * @param integer|string $value |
|
| 41 | * @return Struct\GeneralInfo |
|
| 42 | */ |
|
| 43 | public function get($field, $value) |
|
| 44 | { |
|
| 45 | $items = $this->_getItems(Struct\GeneralInfo::class, 'gen-info', $field, $value); |
|
| 46 | return reset($items); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @return Struct\GeneralInfo[] |
|
| 51 | */ |
|
| 52 | public function getAll() |
|
| 53 | { |
|
| 54 | return $this->_getItems(Struct\GeneralInfo::class, 'gen-info'); |
|
| 55 | } |
|
| 56 | ||
| 57 | ||
| 58 | ||
| 59 | } |
|
| 60 | ||
| @@ 7-57 (lines=51) @@ | ||
| 4 | namespace PleskX\Api\Operator; |
|
| 5 | use PleskX\Api\Struct\Site as Struct; |
|
| 6 | ||
| 7 | class Site extends \PleskX\Api\Operator |
|
| 8 | { |
|
| 9 | ||
| 10 | /** |
|
| 11 | * @param array $properties |
|
| 12 | * @return Struct\Info |
|
| 13 | */ |
|
| 14 | public function create(array $properties) |
|
| 15 | { |
|
| 16 | $packet = $this->_client->getPacket(); |
|
| 17 | $info = $packet->addChild($this->_wrapperTag)->addChild('add'); |
|
| 18 | ||
| 19 | $infoGeneral = $info->addChild('gen_setup'); |
|
| 20 | foreach ($properties as $name => $value) { |
|
| 21 | $infoGeneral->addChild($name, $value); |
|
| 22 | } |
|
| 23 | ||
| 24 | $response = $this->_client->request($packet); |
|
| 25 | return new Struct\Info($response); |
|
| 26 | } |
|
| 27 | ||
| 28 | /** |
|
| 29 | * @param string $field |
|
| 30 | * @param integer|string $value |
|
| 31 | * @return bool |
|
| 32 | */ |
|
| 33 | public function delete($field, $value) |
|
| 34 | { |
|
| 35 | return $this->_delete($field, $value); |
|
| 36 | } |
|
| 37 | ||
| 38 | /** |
|
| 39 | * @param string $field |
|
| 40 | * @param integer|string $value |
|
| 41 | * @return Struct\GeneralInfo |
|
| 42 | */ |
|
| 43 | public function get($field, $value) |
|
| 44 | { |
|
| 45 | $items = $this->_getItems(Struct\GeneralInfo::class, 'gen_info', $field, $value); |
|
| 46 | return reset($items); |
|
| 47 | } |
|
| 48 | ||
| 49 | /** |
|
| 50 | * @return Struct\GeneralInfo[] |
|
| 51 | */ |
|
| 52 | public function getAll() |
|
| 53 | { |
|
| 54 | return $this->_getItems(Struct\GeneralInfo::class, 'gen_info'); |
|
| 55 | } |
|
| 56 | ||
| 57 | } |
|
| 58 | ||