Completed
Push — develop ( 046464...9a0cd6 )
by Jens
13:20
created

ChannelDraft::ofKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 4
Ratio 100 %

Code Coverage

Tests 2
CRAP Score 1
Metric Value
dl 4
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Channel;
7
8
use Commercetools\Core\Model\Common\Context;
9
use Commercetools\Core\Model\Common\JsonObject;
10
use Commercetools\Core\Model\Common\LocalizedString;
11
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
12
13
/**
14
 * @package Commercetools\Core\Model\Channel
15
 * @link https://dev.commercetools.com/http-api-projects-channels.html#create-channel
16
 * @method string getKey()
17
 * @method ChannelDraft setKey(string $key = null)
18
 * @method array getRoles()
19
 * @method ChannelDraft setRoles(array $roles = null)
20
 * @method LocalizedString getName()
21
 * @method ChannelDraft setName(LocalizedString $name = null)
22
 * @method LocalizedString getDescription()
23
 * @method ChannelDraft setDescription(LocalizedString $description = null)
24
 * @method CustomFieldObjectDraft getCustom()
25
 * @method ChannelDraft setCustom(CustomFieldObjectDraft $custom = null)
26
 */
27 View Code Duplication
class ChannelDraft extends JsonObject
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...
28
{
29 3
    public function fieldDefinitions()
30
    {
31
        return [
32 3
            'key' => [static::TYPE => 'string'],
33 3
            'roles' => [static::TYPE => 'array'],
34 3
            'name' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
35 3
            'description' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString'],
36 3
            'custom' => [static::TYPE => '\Commercetools\Core\Model\CustomField\CustomFieldObjectDraft'],
37 3
        ];
38
    }
39
40
    /**
41
     * @param string $key
42
     * @param Context|callable $context
43
     * @return ChannelDraft
44
     */
45 3
    public static function ofKey($key, $context = null)
46
    {
47 3
        return static::of($context)->setKey($key);
48
    }
49
}
50