Code Duplication    Length = 32-33 lines in 2 locations

src/Model/Channel/ChannelReference.php 1 location

@@ 25-56 (lines=32) @@
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
    /**
48
     * @param $key
49
     * @param Context|callable $context
50
     * @return ChannelReference
51
     */
52
    public static function ofKey($key, $context = null)
53
    {
54
        return static::ofTypeAndKey(static::TYPE_CHANNEL, $key, $context);
55
    }
56
}
57

src/Model/State/StateReference.php 1 location

@@ 25-57 (lines=33) @@
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
    /**
49
     * @param $key
50
     * @param Context|callable $context
51
     * @return StateReference
52
     */
53
    public static function ofKey($key, $context = null)
54
    {
55
        return static::ofTypeAndKey(static::TYPE_STATE, $key, $context);
56
    }
57
}
58