Customer::delete()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 2
1
<?php
2
// Copyright 1999-2021. Plesk International GmbH.
3
4
namespace PleskX\Api\Operator;
5
6
use PleskX\Api\Struct\Customer as Struct;
7
8
class Customer extends \PleskX\Api\Operator
9
{
10
    /**
11
     * @param array $properties
12
     *
13
     * @return Struct\Info
14
     */
15 View Code Duplication
    public function create($properties)
0 ignored issues
show
Duplication introduced by
This method 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...
16
    {
17
        $packet = $this->_client->getPacket();
18
        $info = $packet->addChild($this->_wrapperTag)->addChild('add')->addChild('gen_info');
19
20
        foreach ($properties as $name => $value) {
21
            $info->addChild($name, $value);
22
        }
23
24
        $response = $this->_client->request($packet);
25
26
        return new Struct\Info($response);
27
    }
28
29
    /**
30
     * @param string $field
31
     * @param int|string $value
32
     *
33
     * @return bool
34
     */
35
    public function delete($field, $value)
36
    {
37
        return $this->_delete($field, $value);
38
    }
39
40
    /**
41
     * @param string $field
42
     * @param int|string $value
43
     *
44
     * @return Struct\GeneralInfo
45
     */
46
    public function get($field, $value)
47
    {
48
        $items = $this->_getItems(Struct\GeneralInfo::class, 'gen_info', $field, $value);
49
50
        return reset($items);
51
    }
52
53
    /**
54
     * @return Struct\GeneralInfo[]
55
     */
56
    public function getAll()
57
    {
58
        return $this->_getItems(Struct\GeneralInfo::class, 'gen_info');
59
    }
60
}
61