Code Duplication    Length = 18-19 lines in 3 locations

src/Api/Operator/PhpHandler.php 1 location

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

src/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/Api/Operator/SiteAlias.php 1 location

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