Completed
Push — develop ( b357fe...347ecb )
by Jens
11:13
created

ProjectUpdateRequest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 33
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 3
lcom 0
cbo 2
dl 33
loc 33
ccs 7
cts 7
cp 1
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A ofVersion() 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
 */
5
6
namespace Commercetools\Core\Request\Project;
7
8
use Commercetools\Core\Client\JsonEndpoint;
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Model\Project\Project;
11
use Commercetools\Core\Model\Review\Review;
12
use Commercetools\Core\Request\AbstractUpdateRequest;
13
use Commercetools\Core\Response\ApiResponseInterface;
14
use Commercetools\Core\Model\MapperInterface;
15
16
/**
17
 * @package Commercetools\Core\Request\Project
18
 * @link https://dev.commercetools.com/http-api-projects-project.html#update-project
19
 * @method Project mapResponse(ApiResponseInterface $response)
20
 * @method Project mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
21
 */
22 View Code Duplication
class ProjectUpdateRequest extends AbstractUpdateRequest
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
    protected $resultClass = Project::class;
25
26
    /**
27
     * @param string $version
28
     * @param array $actions
29
     * @param Context $context
30
     */
31 6
    public function __construct($version, array $actions = [], Context $context = null)
32
    {
33 6
        parent::__construct(new JsonEndpoint(''), null, $version, $actions, $context);
34 6
    }
35
36
    /**
37
     * @param int $version
38
     * @param Context $context
39
     * @return static
40
     */
41 6
    public static function ofVersion($version, Context $context = null)
42
    {
43 6
        return new static($version, [], $context);
44
    }
45
46
    /**
47
     * @return string
48
     * @internal
49
     */
50 6
    protected function getPath()
51
    {
52 6
        return (string)$this->getEndpoint() . $this->getParamString();
53
    }
54
}
55