Completed
Push — master ( 841fdc...5147f3 )
by Alexei
02:10
created

Reseller::delete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 4
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 2
1
<?php
2
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3
4
namespace PleskX\Api\Operator;
5
use PleskX\Api\Struct\Reseller as Struct;
6
7 View Code Duplication
class Reseller extends \PleskX\Api\Operator
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
8
{
9
10
    /**
11
     * @param array $properties
12
     * @return Struct\Info
13
     */
14
    public function create($properties)
15
    {
16
        $packet = $this->_client->getPacket();
17
        $info = $packet->addChild($this->_wrapperTag)->addChild('add')->addChild('gen-info');
18
19
        foreach ($properties as $name => $value) {
20
            $info->addChild($name, $value);
21
        }
22
23
        $response = $this->_client->request($packet);
24
        return new Struct\Info($response);
25
    }
26
27
    /**
28
     * @param string $field
29
     * @param integer|string $value
30
     * @return bool
31
     */
32
    public function delete($field, $value)
33
    {
34
        return $this->_delete($field, $value);
35
    }
36
37
38
    /**
39
     * @param string $field
40
     * @param integer|string $value
41
     * @return Struct\GeneralInfo
42
     */
43
    public function get($field, $value)
44
    {
45
        $items = $this->_getItems(Struct\GeneralInfo::class, 'gen-info', $field, $value);
46
        return reset($items);
47
    }
48
49
    /**
50
     * @return Struct\GeneralInfo[]
51
     */
52
    public function getAll()
53
    {
54
        return $this->_getItems(Struct\GeneralInfo::class, 'gen-info');
55
    }
56
57
58
59
}
60