Completed
Push — develop ( 32d182...09288a )
by Jens
08:30
created

Transaction   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 60.87 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 14 14 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\Model\Payment;
7
8
use Commercetools\Core\Model\Common\JsonObject;
9
use Commercetools\Core\Model\Common\DateTimeDecorator;
10
use Commercetools\Core\Model\Common\Money;
11
use Commercetools\Core\Model\State\StateReference;
12
13
/**
14
 * @package Commercetools\Core\Model\Payment
15
 * @link https://dev.commercetools.com/http-api-projects-payments.html#transaction
16
 * @method DateTimeDecorator getTimestamp()
17
 * @method Transaction setTimestamp(\DateTime $timestamp = null)
18
 * @method string getType()
19
 * @method Transaction setType(string $type = null)
20
 * @method Money getAmount()
21
 * @method Transaction setAmount(Money $amount = null)
22
 * @method string getInteractionId()
23
 * @method Transaction setInteractionId(string $interactionId = null)
24
 * @method string getId()
25
 * @method Transaction setId(string $id = null)
26
 * @method string getState()
27
 * @method Transaction setState(string $state = null)
28
 */
29
class Transaction extends JsonObject
30
{
31
    const AUTHORIZATION = 'Authorization';
32
    const CANCEL_AUTHORIZATION = 'CancelAuthorization';
33
    const CHARGE = 'Charge';
34
    const REFUND = 'Refund';
35
    const CHARGE_BACK = 'Chargeback';
36
37 1 View Code Duplication
    public function fieldDefinitions()
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...
38
    {
39
        return [
40 1
            'id' => [static::TYPE => 'string'],
41 1
            'state' => [static::TYPE => 'string'],
42
            'timestamp' => [
43 1
                static::TYPE => '\DateTime',
44 1
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
45
            ],
46 1
            'type' => [static::TYPE => 'string'],
47 1
            'amount' => [static::TYPE => '\Commercetools\Core\Model\Common\Money'],
48 1
            'interactionId' => [static::TYPE => 'string'],
49
        ];
50
    }
51
}
52