Test Failed
Push — develop ( c5e053...0e14d9 )
by Jens
25:20 queued 16:23
created

ProductImageAddedMessage   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 14
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 1
lcom 0
cbo 1
dl 14
loc 14
rs 10
c 1
b 0
f 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 9 9 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\Message;
7
8
use Commercetools\Core\Model\Common\DateTimeDecorator;
9
use Commercetools\Core\Model\Common\Image;
10
use Commercetools\Core\Model\Common\Reference;
11
use Commercetools\Core\Model\Product\ProductProjection;
12
use DateTime;
13
14
/**
15
 * @package Commercetools\Core\Model\Message
16
 * @link https://dev.commercetools.com/http-api-projects-messages.html#productimageadded-message
17
 * @method string getId()
18
 * @method ProductImageAddedMessage setId(string $id = null)
19
 * @method int getVersion()
20
 * @method ProductImageAddedMessage setVersion(int $version = null)
21
 * @method DateTimeDecorator getCreatedAt()
22
 * @method ProductImageAddedMessage setCreatedAt(DateTime $createdAt = null)
23
 * @method DateTimeDecorator getLastModifiedAt()
24
 * @method ProductImageAddedMessage setLastModifiedAt(DateTime $lastModifiedAt = null)
25
 * @method int getSequenceNumber()
26
 * @method ProductImageAddedMessage setSequenceNumber(int $sequenceNumber = null)
27
 * @method Reference getResource()
28
 * @method ProductImageAddedMessage setResource(Reference $resource = null)
29
 * @method int getResourceVersion()
30
 * @method ProductImageAddedMessage setResourceVersion(int $resourceVersion = null)
31
 * @method string getType()
32
 * @method ProductImageAddedMessage setType(string $type = null)
33
 * @method int getVariantId()
34
 * @method ProductImageAddedMessage setVariantId(int $variantId = null)
35
 * @method Image getImage()
36
 * @method ProductImageAddedMessage setImage(Image $image = null)
37
 * @method bool getStaged()
38
 * @method ProductImageAddedMessage setStaged(bool $staged = null)
39
 */
40 View Code Duplication
class ProductImageAddedMessage 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...
41
{
42
    const MESSAGE_TYPE = 'ProductImageAdded';
43
44
    public function fieldDefinitions()
45
    {
46
        $definitions = parent::fieldDefinitions();
47
        $definitions['variantId'] = [static::TYPE => 'int'];
48
        $definitions['image'] = [static::TYPE => Image::class];
49
        $definitions['staged'] = [static::TYPE => 'bool'];
50
51
        return $definitions;
52
    }
53
}
54