Code Duplication    Length = 18-19 lines in 3 locations

src/Api/Operator/PhpHandler.php 1 location

@@ 40-58 (lines=19) @@
37
     *
38
     * @return Info[]
39
     */
40
    public function getAll($field = null, $value = null)
41
    {
42
        $packet = $this->_client->getPacket();
43
        $getTag = $packet->addChild($this->_wrapperTag)->addChild('get');
44
45
        $filterTag = $getTag->addChild('filter');
46
        if (!is_null($field)) {
47
            $filterTag->addChild($field, $value);
48
        }
49
50
        $response = $this->_client->request($packet, Client::RESPONSE_FULL);
51
        $items = [];
52
        foreach ($response->xpath('//result') as $xmlResult) {
53
            $item = new Info($xmlResult);
54
            $items[] = $item;
55
        }
56
57
        return $items;
58
    }
59
}
60

src/Api/Operator/SiteAlias.php 1 location

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

src/Api/Operator/ServicePlan.php 1 location

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