| @@ 49-68 (lines=20) @@ | ||
| 46 | *  | 
                                |
| 47 | * @return Struct\Info[]  | 
                                |
| 48 | */  | 
                                |
| 49 | public function getAll($field = null, $value = null)  | 
                                |
| 50 |     { | 
                                |
| 51 | $packet = $this->_client->getPacket();  | 
                                |
| 52 |         $getTag = $packet->addChild($this->_wrapperTag)->addChild('get_rec'); | 
                                |
| 53 | ||
| 54 |         $filterTag = $getTag->addChild('filter'); | 
                                |
| 55 |         if (!is_null($field)) { | 
                                |
| 56 | $filterTag->addChild($field, $value);  | 
                                |
| 57 | }  | 
                                |
| 58 |         $getTag->addChild('template'); | 
                                |
| 59 | ||
| 60 | $response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);  | 
                                |
| 61 | $items = [];  | 
                                |
| 62 |         foreach ($response->xpath('//result') as $xmlResult) { | 
                                |
| 63 | $item = new Struct\Info($xmlResult->data);  | 
                                |
| 64 | $item->id = (int) $xmlResult->id;  | 
                                |
| 65 | $items[] = $item;  | 
                                |
| 66 | }  | 
                                |
| 67 | ||
| 68 | return $items;  | 
                                |
| 69 | }  | 
                                |
| 70 | ||
| 71 | /**  | 
                                |
| @@ 67-90 (lines=24) @@ | ||
| 64 | *  | 
                                |
| 65 | * @return Struct\Info[]  | 
                                |
| 66 | */  | 
                                |
| 67 | public function getAll($field = null, $value = null)  | 
                                |
| 68 |     { | 
                                |
| 69 | $packet = $this->_client->getPacket();  | 
                                |
| 70 |         $getTag = $packet->addChild($this->_wrapperTag)->addChild('get'); | 
                                |
| 71 | ||
| 72 |         $filterTag = $getTag->addChild('filter'); | 
                                |
| 73 |         if (!is_null($field)) { | 
                                |
| 74 | $filterTag->addChild($field, $value);  | 
                                |
| 75 | }  | 
                                |
| 76 | ||
| 77 | $response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);  | 
                                |
| 78 | ||
| 79 | $items = [];  | 
                                |
| 80 |         foreach ($response->xpath('//result') as $xmlResult) { | 
                                |
| 81 |             if (empty($xmlResult->data)) { | 
                                |
| 82 | continue;  | 
                                |
| 83 | }  | 
                                |
| 84 | $item = new Struct\Info($xmlResult->data);  | 
                                |
| 85 | $item->id = (int) $xmlResult->id;  | 
                                |
| 86 | $items[] = $item;  | 
                                |
| 87 | }  | 
                                |
| 88 | ||
| 89 | return $items;  | 
                                |
| 90 | }  | 
                                |
| 91 | }  | 
                                |
| 92 | ||