Code Duplication    Length = 19-19 lines in 2 locations

src/PleskX/Api/Operator/DatabaseServer.php 1 location

@@ 46-64 (lines=19) @@
43
     * @param integer|string|null $value
44
     * @return Struct\Info|Struct\Info[]
45
     */
46
    private function _get($field = null, $value = null)
47
    {
48
        $packet = $this->_client->getPacket();
49
        $getTag = $packet->addChild($this->_wrapperTag)->addChild('get');
50
51
        $filterTag = $getTag->addChild('filter');
52
        if (!is_null($field)) {
53
            $filterTag->addChild($field, $value);
54
        }
55
56
        $response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);
57
58
        $items = [];
59
        foreach ($response->xpath('//result') as $xmlResult) {
60
            $items[] = new Struct\Info($xmlResult->data);
61
        }
62
63
        return $items;
64
    }
65
66
}
67

src/PleskX/Api/Operator/ServicePlan.php 1 location

@@ 35-53 (lines=19) @@
32
     * @param integer|string|null $value
33
     * @return Struct\Info|Struct\Info[]
34
     */
35
    private function _get($field = null, $value = null)
36
    {
37
        $packet = $this->_client->getPacket();
38
        $getTag = $packet->addChild('service-plan')->addChild('get');
39
40
        $filterTag = $getTag->addChild('filter');
41
        if (!is_null($field)) {
42
            $filterTag->addChild($field, $value);
43
        }
44
45
        $response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);
46
47
        $items = [];
48
        foreach ($response->xpath('//result') as $xmlResult) {
49
            $items[] = new Struct\Info($xmlResult);
50
        }
51
52
        return $items;
53
    }
54
55
}
56