Code Duplication    Length = 22-23 lines in 14 locations

src/Model/Cart/CartReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method CartReference setKey(string $key = null)
24
 */
25
class CartReference extends Reference
26
{
27
    const TYPE_CART = 'cart';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Cart\Cart'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return CartReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_CART, $id, $context);
45
    }
46
}
47

src/Model/CartDiscount/CartDiscountReference.php 1 location

@@ 24-45 (lines=22) @@
21
 * @method string getKey()
22
 * @method CartDiscountReference setKey(string $key = null)
23
 */
24
class CartDiscountReference extends Reference
25
{
26
    const TYPE_CART_DISCOUNT = 'cart-discount';
27
28
    public function fieldDefinitions()
29
    {
30
        $fields = parent::fieldDefinitions();
31
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\CartDiscount\CartDiscount'];
32
33
        return $fields;
34
    }
35
36
    /**
37
     * @param $id
38
     * @param Context|callable $context
39
     * @return CartDiscountReference
40
     */
41
    public static function ofId($id, $context = null)
42
    {
43
        return static::ofTypeAndId(static::TYPE_CART_DISCOUNT, $id, $context);
44
    }
45
}
46

src/Model/Channel/ChannelReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method ChannelReference setKey(string $key = null)
24
 */
25
class ChannelReference extends Reference
26
{
27
    const TYPE_CHANNEL = 'channel';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Channel\Channel'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return ChannelReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_CHANNEL, $id, $context);
45
    }
46
}
47

src/Model/Customer/CustomerReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method CustomerReference setKey(string $key = null)
24
 */
25
class CustomerReference extends Reference
26
{
27
    const TYPE_CUSTOMER = 'customer';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Customer\Customer'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return CustomerReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_CUSTOMER, $id, $context);
45
    }
46
}
47

src/Model/CustomerGroup/CustomerGroupReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method CustomerGroupReference setKey(string $key = null)
24
 */
25
class CustomerGroupReference extends Reference
26
{
27
    const TYPE_CUSTOMER_GROUP = 'customer-group';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\CustomerGroup\CustomerGroup'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return CustomerGroupReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_CUSTOMER_GROUP, $id, $context);
45
    }
46
}
47

src/Model/DiscountCode/DiscountCodeReference.php 1 location

@@ 24-45 (lines=22) @@
21
 * @method string getKey()
22
 * @method DiscountCodeReference setKey(string $key = null)
23
 */
24
class DiscountCodeReference extends Reference
25
{
26
    const TYPE_DISCOUNT_CODE = 'discount-code';
27
28
    public function fieldDefinitions()
29
    {
30
        $fields = parent::fieldDefinitions();
31
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\DiscountCode\DiscountCode'];
32
33
        return $fields;
34
    }
35
36
    /**
37
     * @param $id
38
     * @param Context|callable $context
39
     * @return DiscountCodeReference
40
     */
41
    public static function ofId($id, $context = null)
42
    {
43
        return static::ofTypeAndId(static::TYPE_DISCOUNT_CODE, $id, $context);
44
    }
45
}
46

src/Model/Order/OrderReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method OrderReference setKey(string $key = null)
24
 */
25
class OrderReference extends Reference
26
{
27
    const TYPE_ORDER = 'order';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Order\Order'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return OrderReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_ORDER, $id, $context);
45
    }
46
}
47

src/Model/Payment/PaymentReference.php 1 location

@@ 24-45 (lines=22) @@
21
 * @method string getKey()
22
 * @method PaymentReference setKey(string $key = null)
23
 */
24
class PaymentReference extends Reference
25
{
26
    const TYPE_PAYMENT = 'payment';
27
28
    public function fieldDefinitions()
29
    {
30
        $fields = parent::fieldDefinitions();
31
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Payment\Payment'];
32
33
        return $fields;
34
    }
35
36
    /**
37
     * @param $id
38
     * @param Context|callable $context
39
     * @return PaymentReference
40
     */
41
    public static function ofId($id, $context = null)
42
    {
43
        return static::ofTypeAndId(static::TYPE_PAYMENT, $id, $context);
44
    }
45
}
46

src/Model/Product/ProductReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method ProductReference setKey(string $key = null)
24
 */
25
class ProductReference extends Reference
26
{
27
    const TYPE_PRODUCT = 'product';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Product\Product'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return ProductReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_PRODUCT, $id, $context);
45
    }
46
}
47

src/Model/ProductDiscount/ProductDiscountReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method ProductDiscountReference setKey(string $key = null)
24
 */
25
class ProductDiscountReference extends Reference
26
{
27
    const TYPE_PRODUCT_DISCOUNT = 'product-discount';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\ProductDiscount\ProductDiscount'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return ProductDiscountReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_PRODUCT_DISCOUNT, $id, $context);
45
    }
46
}
47

src/Model/ShippingMethod/ShippingMethodReference.php 1 location

@@ 24-45 (lines=22) @@
21
 * @method string getKey()
22
 * @method ShippingMethodReference setKey(string $key = null)
23
 */
24
class ShippingMethodReference extends Reference
25
{
26
    const TYPE_SHIPPING_METHOD = 'shipping-method';
27
28
    public function fieldDefinitions()
29
    {
30
        $fields = parent::fieldDefinitions();
31
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\ShippingMethod\ShippingMethod'];
32
33
        return $fields;
34
    }
35
36
    /**
37
     * @param $id
38
     * @param Context|callable $context
39
     * @return ShippingMethodReference
40
     */
41
    public static function ofId($id, $context = null)
42
    {
43
        return static::ofTypeAndId(static::TYPE_SHIPPING_METHOD, $id, $context);
44
    }
45
}
46

src/Model/State/StateReference.php 1 location

@@ 25-47 (lines=23) @@
22
 * @method string getKey()
23
 * @method StateReference setKey(string $key = null)
24
 */
25
class StateReference extends Reference
26
{
27
    const TYPE_STATE = 'state';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\State\State'];
33
34
        return $fields;
35
    }
36
37
38
    /**
39
     * @param $id
40
     * @param Context|callable $context
41
     * @return StateReference
42
     */
43
    public static function ofId($id, $context = null)
44
    {
45
        return static::ofTypeAndId(static::TYPE_STATE, $id, $context);
46
    }
47
}
48

src/Model/TaxCategory/TaxCategoryReference.php 1 location

@@ 25-46 (lines=22) @@
22
 * @method string getKey()
23
 * @method TaxCategoryReference setKey(string $key = null)
24
 */
25
class TaxCategoryReference extends Reference
26
{
27
    const TYPE_TAX_CATEGORY = 'tax-category';
28
29
    public function fieldDefinitions()
30
    {
31
        $fields = parent::fieldDefinitions();
32
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\TaxCategory\TaxCategory'];
33
34
        return $fields;
35
    }
36
37
    /**
38
     * @param $id
39
     * @param Context|callable $context
40
     * @return TaxCategoryReference
41
     */
42
    public static function ofId($id, $context = null)
43
    {
44
        return static::ofTypeAndId(static::TYPE_TAX_CATEGORY, $id, $context);
45
    }
46
}
47

src/Model/Zone/ZoneReference.php 1 location

@@ 24-45 (lines=22) @@
21
 * @method string getKey()
22
 * @method ZoneReference setKey(string $key = null)
23
 */
24
class ZoneReference extends Reference
25
{
26
    const TYPE_ZONE = 'zone';
27
28
    public function fieldDefinitions()
29
    {
30
        $fields = parent::fieldDefinitions();
31
        $fields[static::OBJ] = [static::TYPE => '\Commercetools\Core\Model\Zone\Zone'];
32
33
        return $fields;
34
    }
35
36
    /**
37
     * @param $id
38
     * @param Context|callable $context
39
     * @return ZoneReference
40
     */
41
    public static function ofId($id, $context = null)
42
    {
43
        return static::ofTypeAndId(static::TYPE_ZONE, $id, $context);
44
    }
45
}
46