Passed
Push — develop ( c3a5bd...0fb661 )
by Jens
17:20
created

CustomLineItemStateTransitionMessage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 23
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 18 18 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 @jenschude <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Message;
7
8
use Commercetools\Core\Model\Common\DateTimeDecorator;
9
use Commercetools\Core\Model\Common\Reference;
10
use Commercetools\Core\Model\State\StateReference;
11
use DateTime;
12
13
/**
14
 * @package Commercetools\Core\Model\Message
15
 * @link https://docs.commercetools.com/http-api-projects-messages.html#customlineitemstatetransition-message
16
 * @method string getId()
17
 * @method CustomLineItemStateTransitionMessage setId(string $id = null)
18
 * @method DateTimeDecorator getCreatedAt()
19
 * @method CustomLineItemStateTransitionMessage setCreatedAt(DateTime $createdAt = null)
20
 * @method int getSequenceNumber()
21
 * @method CustomLineItemStateTransitionMessage setSequenceNumber(int $sequenceNumber = null)
22
 * @method Reference getResource()
23
 * @method CustomLineItemStateTransitionMessage setResource(Reference $resource = null)
24
 * @method int getResourceVersion()
25
 * @method CustomLineItemStateTransitionMessage setResourceVersion(int $resourceVersion = null)
26
 * @method string getType()
27
 * @method CustomLineItemStateTransitionMessage setType(string $type = null)
28
 * @method string getCustomLineItemId()
29
 * @method CustomLineItemStateTransitionMessage setCustomLineItemId(string $customLineItemId = null)
30
 * @method DateTimeDecorator getTransitionDate()
31
 * @method CustomLineItemStateTransitionMessage setTransitionDate(DateTime $transitionDate = null)
32
 * @method int getQuantity()
33
 * @method CustomLineItemStateTransitionMessage setQuantity(int $quantity = null)
34
 * @method StateReference getFromState()
35
 * @method CustomLineItemStateTransitionMessage setFromState(StateReference $fromState = null)
36
 * @method StateReference getToState()
37
 * @method CustomLineItemStateTransitionMessage setToState(StateReference $toState = null)
38
 * @method int getVersion()
39
 * @method CustomLineItemStateTransitionMessage setVersion(int $version = null)
40
 * @method DateTimeDecorator getLastModifiedAt()
41
 * @method CustomLineItemStateTransitionMessage setLastModifiedAt(DateTime $lastModifiedAt = null)
42
 */
43 View Code Duplication
class CustomLineItemStateTransitionMessage extends Message
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...
44
{
45
    const MESSAGE_TYPE = 'CustomLineItemStateTransition';
46
47 1
    public function fieldDefinitions()
48
    {
49 1
        $definitions = array_merge(
50 1
            parent::fieldDefinitions(),
51
            [
52 1
                'customLineItemId' => [static::TYPE => 'string'],
53
                'transitionDate' => [
54 1
                    static::TYPE => DateTime::class,
55 1
                    static::DECORATOR => DateTimeDecorator::class
56
                ],
57 1
                'quantity' => [static::TYPE => 'int'],
58 1
                'fromState' => [static::TYPE => StateReference::class],
59 1
                'toState' => [static::TYPE => StateReference::class],
60
            ]
61
        );
62
63 1
        return $definitions;
64
    }
65
}
66