Completed
Push — develop ( 79f8cb...57f680 )
by Jens
09:18
created

PaymentReference::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 7
Ratio 100 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 7
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Payment;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\Reference;
10
11
/**
12
 * @package Commercetools\Core\Model\Payment
13
 * @link https://dev.commercetools.com/http-api-types.html#reference-types
14
 * @link https://dev.commercetools.com/http-api-projects-payments.html#payment
15
 * @method string getTypeId()
16
 * @method PaymentReference setTypeId(string $typeId = null)
17
 * @method string getId()
18
 * @method PaymentReference setId(string $id = null)
19
 * @method Payment getObj()
20
 * @method PaymentReference setObj(Payment $obj = null)
21
 * @method string getKey()
22
 * @method PaymentReference setKey(string $key = null)
23
 */
24 View Code Duplication
class PaymentReference 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...
25
{
26
    const TYPE_PAYMENT = 'payment';
27
28 1
    public function fieldDefinitions()
29
    {
30 1
        $fields = parent::fieldDefinitions();
31 1
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Payment\Payment'];
32
33 1
        return $fields;
34
    }
35
36
    /**
37
     * @param $id
38
     * @param Context|callable $context
39
     * @return PaymentReference
40
     */
41 1
    public static function ofId($id, $context = null)
42
    {
43 1
        return static::ofTypeAndId(static::TYPE_PAYMENT, $id, $context);
44
    }
45
}
46