Code Duplication    Length = 19-19 lines in 3 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($this->_wrapperTag)->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

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

@@ 56-74 (lines=19) @@
53
     * @param integer|string $value
54
     * @return Struct\Info[]
55
     */
56
    public function _get($keyId = null)
57
    {
58
        $packet = $this->_client->getPacket();
59
        $getTag = $packet->addChild($this->_wrapperTag)->addChild('get_info');
60
61
        $filterTag = $getTag->addChild('filter');
62
        if (!is_null($keyId)) {
63
            $filterTag->addChild('key', $keyId);
64
        }
65
66
        $response = $this->_client->request($packet, \PleskX\Api\Client::RESPONSE_FULL);
67
68
        $items = [];
69
        foreach ($response->xpath('//result') as $xmlResult) {
70
            $items[] = new Struct\Info($xmlResult->key_info);
71
        }
72
73
        return $items;
74
    }
75
76
}
77