Completed
Push — master ( 18bfc7...82e0b5 )
by Jens
18:00 queued 05:19
created

SubscriptionReference   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 100 %

Coupling/Cohesion

Components 0
Dependencies 1

Test Coverage

Coverage 0%

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofId() 4 4 1
A ofKey() 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
 * @created: 27.01.15, 18:22
5
 */
6
7
namespace Commercetools\Core\Model\Subscription;
8
9
use Commercetools\Core\Model\Common\Context;
10
use Commercetools\Core\Model\Common\Reference;
11
12
/**
13
 * @package Commercetools\Core\Model\Subscription
14
 * @link https://dev.commercetools.com/http-api-types.html#reference-types
15
 * @link https://dev.commercetools.com/http-api-projects-subscriptions.html#subscription
16
 * @method string getTypeId()
17
 * @method SubscriptionReference setTypeId(string $typeId = null)
18
 * @method string getId()
19
 * @method SubscriptionReference setId(string $id = null)
20
 * @method string getKey()
21
 * @method SubscriptionReference setKey(string $key = null)
22
 * @method Subscription getObj()
23
 * @method SubscriptionReference setObj(Subscription $obj = null)
24
 */
25 View Code Duplication
class SubscriptionReference extends Reference
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...
26
{
27
    const TYPE_SUBSCRIPTION = 'subscription';
28
    const TYPE_CLASS = '\Commercetools\Core\Model\Subscription\Subscription';
29
30
    /**
31
     * @param $id
32
     * @param Context|callable $context
33
     * @return SubscriptionReference
34
     */
35
    public static function ofId($id, $context = null)
36
    {
37
        return static::ofTypeAndId(static::TYPE_SUBSCRIPTION, $id, $context);
38
    }
39
40
    /**
41
     * @param $key
42
     * @param Context|callable $context
43
     * @return SubscriptionReference
44
     */
45
    public static function ofKey($key, $context = null)
46
    {
47
        return static::ofTypeAndKey(static::TYPE_SUBSCRIPTION, $key, $context);
48
    }
49
}
50