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/ServicePlan.php 1 location

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

src/Api/Operator/SiteAlias.php 1 location

@@ 67-84 (lines=18) @@
64
     *
65
     * @return Struct\GeneralInfo[]
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
        $items = [];
79
        foreach ($response->xpath('//result') as $xmlResult) {
80
            $item = new Struct\GeneralInfo($xmlResult->info);
81
            $items[] = $item;
82
        }
83
84
        return $items;
85
    }
86
}
87