Completed
Push — master ( 72836f...af7a4a )
by Alexei
11s
created

Subdomain   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
c 1
b 0
f 0
lcom 1
cbo 3
dl 19
loc 19
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A create() 12 12 2

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
// Copyright 1999-2016. Parallels IP Holdings GmbH.
3
4
namespace PleskX\Api\Operator;
5
use PleskX\Api\Struct\Subdomain as Struct;
6
7 View Code Duplication
class Subdomain 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
     * @param array $properties
11
     * @return Struct\Info
12
     */
13
    public function create($properties)
14
    {
15
        $packet = $this->_client->getPacket();
16
        $info = $packet->addChild($this->_wrapperTag)->addChild('add');
17
18
        foreach ($properties as $name => $value) {
19
            $info->addChild($name, $value);
20
        }
21
22
        $response = $this->_client->request($packet);
23
        return new Struct\Info($response);
24
    }
25
}
26