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

CustomerCreatedMessage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
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 12
loc 12
ccs 4
cts 4
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 7 7 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\Customer\Customer;
11
use DateTime;
12
13
/**
14
 * @package Commercetools\Core\Model\Message
15
 * @link https://docs.commercetools.com/http-api-projects-messages.html#customercreated-message
16
 * @method string getId()
17
 * @method CustomerCreatedMessage setId(string $id = null)
18
 * @method DateTimeDecorator getCreatedAt()
19
 * @method CustomerCreatedMessage setCreatedAt(DateTime $createdAt = null)
20
 * @method int getSequenceNumber()
21
 * @method CustomerCreatedMessage setSequenceNumber(int $sequenceNumber = null)
22
 * @method Reference getResource()
23
 * @method CustomerCreatedMessage setResource(Reference $resource = null)
24
 * @method int getResourceVersion()
25
 * @method CustomerCreatedMessage setResourceVersion(int $resourceVersion = null)
26
 * @method string getType()
27
 * @method CustomerCreatedMessage setType(string $type = null)
28
 * @method Customer getCustomer()
29
 * @method CustomerCreatedMessage setCustomer(Customer $customer = null)
30
 * @method int getVersion()
31
 * @method CustomerCreatedMessage setVersion(int $version = null)
32
 * @method DateTimeDecorator getLastModifiedAt()
33
 * @method CustomerCreatedMessage setLastModifiedAt(DateTime $lastModifiedAt = null)
34
 */
35 View Code Duplication
class CustomerCreatedMessage 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...
36
{
37
    const MESSAGE_TYPE = 'CustomerCreated';
38
39 1
    public function fieldDefinitions()
40
    {
41 1
        $definitions = parent::fieldDefinitions();
42 1
        $definitions['customer'] = [static::TYPE => Customer::class];
43
44 1
        return $definitions;
45
    }
46
}
47