Passed
Push — develop ( e68aaf...da32ce )
by Jens
08:58
created

PaymentUpdateByKeyRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 26
loc 26
ccs 5
cts 5
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 4 4 1
A ofKeyAndVersion() 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\Payments;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Request\AbstractUpdateByKeyRequest;
10
use Commercetools\Core\Request\AbstractUpdateRequest;
11
use Commercetools\Core\Model\Payment\Payment;
12
use Commercetools\Core\Response\ApiResponseInterface;
13
use Commercetools\Core\Model\MapperInterface;
14
15
/**
16
 * @package Commercetools\Core\Request\Payments
17
 * @link https://dev.commercetools.com/http-api-projects-payments.html#update-payment-by-key
18
 * @method Payment mapResponse(ApiResponseInterface $response)
19
 * @method Payment mapFromResponse(ApiResponseInterface $response, MapperInterface $mapper = null)
20
 */
21 View Code Duplication
class PaymentUpdateByKeyRequest extends AbstractUpdateByKeyRequest
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...
22
{
23
    protected $resultClass = Payment::class;
24
25
    /**
26
     * @param string $key
27
     * @param string $version
28
     * @param array $actions
29
     * @param Context $context
30
     */
31 1
    public function __construct($key, $version, array $actions = [], Context $context = null)
32
    {
33 1
        parent::__construct(PaymentsEndpoint::endpoint(), $key, $version, $actions, $context);
34 1
    }
35
36
    /**
37
     * @param string $key
38
     * @param int $version
39
     * @param Context $context
40
     * @return static
41
     */
42 1
    public static function ofKeyAndVersion($key, $version, Context $context = null)
43
    {
44 1
        return new static($key, $version, [], $context);
45
    }
46
}
47