Completed
Push — develop ( 5e9601...0ad397 )
by
unknown
11:49
created

AbstractDeleteByKeyRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 3
c 1
b 0
f 1
lcom 1
cbo 1
dl 28
loc 28
ccs 0
cts 12
cp 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getKey() 4 4 1
A setKey() 4 4 1
A getPath() 4 4 1

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
/**
3
 * @author @jayS-de <[email protected]>
4
 * @created: 26.01.15, 17:22
5
 */
6
7
namespace Commercetools\Core\Request;
8
9
use Psr\Http\Message\ResponseInterface;
10
use Commercetools\Core\Client;
11
use Commercetools\Core\Client\HttpMethod;
12
use Commercetools\Core\Client\HttpRequest;
13
use Commercetools\Core\Client\JsonEndpoint;
14
use Commercetools\Core\Model\Common\Context;
15
use Commercetools\Core\Request\Query\Parameter;
16
use Commercetools\Core\Response\ResourceResponse;
17
18
/**
19
 * @package Commercetools\Core\Request
20
 * @method ResourceResponse executeWithClient(Client $client)
21
 */
22 View Code Duplication
abstract class AbstractDeleteByKeyRequest extends AbstractDeleteRequest
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...
23
{
24
    /**
25
     * @return string
26
     */
27
    public function getKey()
28
    {
29
        return $this->getId();
30
    }
31
32
    /**
33
     * @param $key
34
     * @return $this
35
     */
36
    public function setKey($key)
37
    {
38
        return $this->setId($key);
39
    }
40
41
    /**
42
     * @return string
43
     * @internal
44
     */
45
    protected function getPath()
46
    {
47
        return (string)$this->getEndpoint() . '/key=' . $this->getId() . $this->getParamString();
48
    }
49
}
50