@@ 18-32 (lines=15) @@ | ||
15 | * |
|
16 | * @return Info |
|
17 | */ |
|
18 | public function get($field, $value) |
|
19 | { |
|
20 | $packet = $this->_client->getPacket(); |
|
21 | $getTag = $packet->addChild($this->_wrapperTag)->addChild('get'); |
|
22 | $filterTag = $getTag->addChild('filter'); |
|
23 | ||
24 | if (!is_null($field)) { |
|
25 | $filterTag->addChild($field, $value); |
|
26 | } |
|
27 | ||
28 | $response = $this->_client->request($packet, Client::RESPONSE_FULL); |
|
29 | $xmlResult = $response->xpath('//result')[0]; |
|
30 | ||
31 | return new Info($xmlResult); |
|
32 | } |
|
33 | ||
34 | /** |
|
35 | * @param string|null $field |
@@ 71-89 (lines=19) @@ | ||
68 | * |
|
69 | * @return Struct\Info[] |
|
70 | */ |
|
71 | public function _get($keyId = null) |
|
72 | { |
|
73 | $packet = $this->_client->getPacket(); |
|
74 | $getTag = $packet->addChild($this->_wrapperTag)->addChild('get_info'); |
|
75 | ||
76 | $filterTag = $getTag->addChild('filter'); |
|
77 | if (!is_null($keyId)) { |
|
78 | $filterTag->addChild('key', $keyId); |
|
79 | } |
|
80 | ||
81 | $response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL); |
|
82 | ||
83 | $items = []; |
|
84 | foreach ($response->xpath('//result/key_info') as $keyInfo) { |
|
85 | $items[] = new Struct\Info($keyInfo); |
|
86 | } |
|
87 | ||
88 | return $items; |
|
89 | } |
|
90 | } |
|
91 |