Code Duplication    Length = 31-35 lines in 19 locations

src/Request/Orders/Command/OrderAddParcelToDeliveryAction.php 1 location

@@ 25-56 (lines=32) @@
22
 * @method TrackingData getTrackingData()
23
 * @method OrderAddParcelToDeliveryAction setTrackingData(TrackingData $trackingData = null)
24
 */
25
class OrderAddParcelToDeliveryAction extends AbstractAction
26
{
27
    public function fieldDefinitions()
28
    {
29
        return [
30
            'action' => [static::TYPE => 'string'],
31
            'deliveryId' => [static::TYPE => 'string'],
32
            'measurements' => [static::TYPE => '\Commercetools\Core\Model\Order\ParcelMeasurements'],
33
            'trackingData' => [static::TYPE => '\Commercetools\Core\Model\Order\TrackingData']
34
        ];
35
    }
36
37
    /**
38
     * @param array $data
39
     * @param Context|callable $context
40
     */
41
    public function __construct(array $data = [], $context = null)
42
    {
43
        parent::__construct($data, $context);
44
        $this->setAction('addParcelToDelivery');
45
    }
46
47
    /**
48
     * @param string $deliveryId
49
     * @param Context|callable $context
50
     * @return OrderAddParcelToDeliveryAction
51
     */
52
    public static function ofDeliveryId($deliveryId, $context = null)
53
    {
54
        return static::of($context)->setDeliveryId($deliveryId);
55
    }
56
}
57

src/Request/Orders/Command/OrderUpdateSyncInfoAction.php 1 location

@@ 25-59 (lines=35) @@
22
 * @method DateTimeDecorator getSyncedAt()
23
 * @method OrderUpdateSyncInfoAction setSyncedAt(\DateTime $syncedAt = null)
24
 */
25
class OrderUpdateSyncInfoAction extends AbstractAction
26
{
27
    /**
28
     * @param array $data
29
     * @param Context|callable $context
30
     */
31
    public function __construct(array $data = [], $context = null)
32
    {
33
        parent::__construct($data, $context);
34
        $this->setAction('updateSyncInfo');
35
    }
36
37
    public function fieldDefinitions()
38
    {
39
        return [
40
            'action' => [static::TYPE => 'string'],
41
            'channel' => [static::TYPE => '\Commercetools\Core\Model\Channel\ChannelReference'],
42
            'externalId' => [static::TYPE => 'string'],
43
            'syncedAt' => [
44
                static::TYPE => '\DateTime',
45
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
46
            ]
47
        ];
48
    }
49
50
    /**
51
     * @param ChannelReference $channel
52
     * @param Context|callable $context
53
     * @return OrderUpdateSyncInfoAction
54
     */
55
    public static function ofChannel(ChannelReference $channel, $context = null)
56
    {
57
        return static::of($context)->setChannel($channel);
58
    }
59
}
60

src/Request/Payments/Command/PaymentChangeTransactionTimestampAction.php 1 location

@@ 23-57 (lines=35) @@
20
 * @method DateTimeDecorator getTimestamp()
21
 * @method PaymentChangeTransactionTimestampAction setTimestamp(\DateTime $timestamp = null)
22
 */
23
class PaymentChangeTransactionTimestampAction extends AbstractAction
24
{
25
    public function fieldDefinitions()
26
    {
27
        return [
28
            'action' => [static::TYPE => 'string'],
29
            'transactionId' => [static::TYPE => 'string'],
30
            'timestamp' => [
31
                static::TYPE => '\DateTime',
32
                static::DECORATOR => '\Commercetools\Core\Model\Common\DateTimeDecorator'
33
            ],
34
        ];
35
    }
36
37
    /**
38
     * @param array $data
39
     * @param Context|callable $context
40
     */
41
    public function __construct(array $data = [], $context = null)
42
    {
43
        parent::__construct($data, $context);
44
        $this->setAction('changeTransactionTimestamp');
45
    }
46
47
    /**
48
     * @param string $transactionId
49
     * @param \DateTime $timestamp
50
     * @param Context|callable $context
51
     * @return PaymentAddTransactionAction
52
     */
53
    public static function ofTransactionIdAndTimestamp($transactionId, \DateTime $timestamp, $context = null)
54
    {
55
        return static::of($context)->setTransactionId($transactionId)->setTimestamp($timestamp);
56
    }
57
}
58

src/Request/Products/Command/ProductAddExternalImageAction.php 1 location

@@ 24-56 (lines=33) @@
21
 * @method bool getStaged()
22
 * @method ProductAddExternalImageAction setStaged(bool $staged = null)
23
 */
24
class ProductAddExternalImageAction extends AbstractAction
25
{
26
    public function fieldDefinitions()
27
    {
28
        return [
29
            'action' => [static::TYPE => 'string'],
30
            'variantId' => [static::TYPE => 'int'],
31
            'image' => [static::TYPE => '\Commercetools\Core\Model\Common\Image'],
32
            'staged' => [static::TYPE => 'bool'],
33
        ];
34
    }
35
36
    /**
37
     * @param array $data
38
     * @param Context|callable $context
39
     */
40
    public function __construct(array $data = [], $context = null)
41
    {
42
        parent::__construct($data, $context);
43
        $this->setAction('addExternalImage');
44
    }
45
46
    /**
47
     * @param int $variantId
48
     * @param Image $image
49
     * @param Context|callable $context
50
     * @return ProductAddExternalImageAction
51
     */
52
    public static function ofVariantIdAndImage($variantId, Image $image, $context = null)
53
    {
54
        return static::of($context)->setVariantId($variantId)->setImage($image);
55
    }
56
}
57

src/Request/Products/Command/ProductAddPriceAction.php 1 location

@@ 24-56 (lines=33) @@
21
 * @method bool getStaged()
22
 * @method ProductAddPriceAction setStaged(bool $staged = null)
23
 */
24
class ProductAddPriceAction extends AbstractAction
25
{
26
    public function fieldDefinitions()
27
    {
28
        return [
29
            'action' => [static::TYPE => 'string'],
30
            'variantId' => [static::TYPE => 'int'],
31
            'price' => [static::TYPE => '\Commercetools\Core\Model\Common\PriceDraft'],
32
            'staged' => [static::TYPE => 'bool'],
33
        ];
34
    }
35
36
    /**
37
     * @param array $data
38
     * @param Context|callable $context
39
     */
40
    public function __construct(array $data = [], $context = null)
41
    {
42
        parent::__construct($data, $context);
43
        $this->setAction('addPrice');
44
    }
45
46
    /**
47
     * @param int $variantId
48
     * @param PriceDraft $price
49
     * @param Context|callable $context
50
     * @return ProductAddPriceAction
51
     */
52
    public static function ofVariantIdAndPrice($variantId, PriceDraft $price, $context = null)
53
    {
54
        return static::of($context)->setVariantId($variantId)->setPrice($price);
55
    }
56
}
57

src/Request/Products/Command/ProductChangePriceAction.php 1 location

@@ 24-56 (lines=33) @@
21
 * @method string getPriceId()
22
 * @method ProductChangePriceAction setPriceId(string $priceId = null)
23
 */
24
class ProductChangePriceAction extends AbstractAction
25
{
26
    public function fieldDefinitions()
27
    {
28
        return [
29
            'action' => [static::TYPE => 'string'],
30
            'priceId' => [static::TYPE => 'string'],
31
            'price' => [static::TYPE => '\Commercetools\Core\Model\Common\PriceDraft'],
32
            'staged' => [static::TYPE => 'bool'],
33
        ];
34
    }
35
36
    /**
37
     * @param array $data
38
     * @param Context|callable $context
39
     */
40
    public function __construct(array $data = [], $context = null)
41
    {
42
        parent::__construct($data, $context);
43
        $this->setAction('changePrice');
44
    }
45
46
    /**
47
     * @param string $priceId
48
     * @param PriceDraft $price
49
     * @param Context|callable $context
50
     * @return ProductChangePriceAction
51
     */
52
    public static function ofPriceIdAndPrice($priceId, PriceDraft $price, $context = null)
53
    {
54
        return static::of($context)->setPriceId($priceId)->setPrice($price);
55
    }
56
}
57

src/Request/Products/Command/ProductRemoveImageAction.php 1 location

@@ 23-55 (lines=33) @@
20
 * @method bool getStaged()
21
 * @method ProductRemoveImageAction setStaged(bool $staged = null)
22
 */
23
class ProductRemoveImageAction extends AbstractAction
24
{
25
    public function fieldDefinitions()
26
    {
27
        return [
28
            'action' => [static::TYPE => 'string'],
29
            'variantId' => [static::TYPE => 'int'],
30
            'imageUrl' => [static::TYPE => 'string'],
31
            'staged' => [static::TYPE => 'bool'],
32
        ];
33
    }
34
35
    /**
36
     * @param array $data
37
     * @param Context|callable $context
38
     */
39
    public function __construct(array $data = [], $context = null)
40
    {
41
        parent::__construct($data, $context);
42
        $this->setAction('removeImage');
43
    }
44
45
    /**
46
     * @param int $variantId
47
     * @param string $imageUrl
48
     * @param Context|callable $context
49
     * @return ProductRemoveImageAction
50
     */
51
    public static function ofVariantIdAndImageUrl($variantId, $imageUrl, $context = null)
52
    {
53
        return static::of($context)->setVariantId($variantId)->setImageUrl($imageUrl);
54
    }
55
}
56

src/Request/Products/Command/ProductSetAttributeAction.php 1 location

@@ 25-58 (lines=34) @@
22
 * @method bool getStaged()
23
 * @method ProductSetAttributeAction setStaged(bool $staged = null)
24
 */
25
class ProductSetAttributeAction extends AbstractAction
26
{
27
    public function fieldDefinitions()
28
    {
29
        return [
30
            'action' => [static::TYPE => 'string'],
31
            'variantId' => [static::TYPE => 'int'],
32
            'name' => [static::TYPE => 'string'],
33
            'value' => [static::TYPE => null],
34
            'staged' => [static::TYPE => 'bool'],
35
        ];
36
    }
37
38
    /**
39
     * @param array $data
40
     * @param Context|callable $context
41
     */
42
    public function __construct(array $data = [], $context = null)
43
    {
44
        parent::__construct($data, $context);
45
        $this->setAction('setAttribute');
46
    }
47
48
    /**
49
     * @param int $variantId
50
     * @param string $name
51
     * @param Context|callable $context
52
     * @return ProductSetAttributeAction
53
     */
54
    public static function ofVariantIdAndName($variantId, $name, $context = null)
55
    {
56
        return static::of($context)->setVariantId($variantId)->setName($name);
57
    }
58
}
59

src/Request/Products/Command/ProductSetAttributeInAllVariantsAction.php 1 location

@@ 23-54 (lines=32) @@
20
 * @method bool getStaged()
21
 * @method ProductSetAttributeInAllVariantsAction setStaged(bool $staged = null)
22
 */
23
class ProductSetAttributeInAllVariantsAction extends AbstractAction
24
{
25
    public function fieldDefinitions()
26
    {
27
        return [
28
            'action' => [static::TYPE => 'string'],
29
            'name' => [static::TYPE => 'string'],
30
            'value' => [static::TYPE => null],
31
            'staged' => [static::TYPE => 'bool'],
32
        ];
33
    }
34
35
    /**
36
     * @param array $data
37
     * @param Context|callable $context
38
     */
39
    public function __construct(array $data = [], $context = null)
40
    {
41
        parent::__construct($data, $context);
42
        $this->setAction('setAttributeInAllVariants');
43
    }
44
45
    /**
46
     * @param string $name
47
     * @param Context|callable $context
48
     * @return ProductSetAttributeInAllVariantsAction
49
     */
50
    public static function ofName($name, $context = null)
51
    {
52
        return static::of($context)->setName($name);
53
    }
54
}
55

src/Request/States/Command/TransitionStateAction.php 1 location

@@ 22-52 (lines=31) @@
19
 * @method bool getForce()
20
 * @method TransitionStateAction setForce(bool $force = null)
21
 */
22
class TransitionStateAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'state' => [static::TYPE => '\Commercetools\Core\Model\State\StateReference'],
29
            'force' =>  [static::TYPE => 'bool']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('transitionState');
41
    }
42
43
    /**
44
     * @param StateReference $state
45
     * @param Context|callable $context
46
     * @return static
47
     */
48
    public static function ofState(StateReference $state, $context = null)
49
    {
50
        return static::of($context)->setState($state);
51
    }
52
}
53

src/Request/Products/Command/ProductSetCategoryOrderHintAction.php 1 location

@@ 24-55 (lines=32) @@
21
 * @method bool getStaged()
22
 * @method ProductSetCategoryOrderHintAction setStaged(bool $staged = null)
23
 */
24
class ProductSetCategoryOrderHintAction extends AbstractAction
25
{
26
    public function fieldDefinitions()
27
    {
28
        return [
29
            'action' => [static::TYPE => 'string'],
30
            'categoryId' => [static::TYPE => 'string'],
31
            'orderHint' => [static::TYPE => 'string'],
32
            'staged' => [static::TYPE => 'bool'],
33
        ];
34
    }
35
36
    /**
37
     * @param array $data
38
     * @param Context|callable $context
39
     */
40
    public function __construct(array $data = [], $context = null)
41
    {
42
        parent::__construct($data, $context);
43
        $this->setAction('setCategoryOrderHint');
44
    }
45
46
    /**
47
     * @param string $categoryId
48
     * @param Context|callable $context
49
     * @return ProductSetCategoryOrderHintAction
50
     */
51
    public static function ofCategoryId($categoryId, $context = null)
52
    {
53
        return static::of($context)->setCategoryId($categoryId);
54
    }
55
}
56

src/Request/Products/Command/ProductSetPricesAction.php 1 location

@@ 25-57 (lines=33) @@
22
 * @method int getVariantId()
23
 * @method ProductSetPricesAction setVariantId(int $variantId = null)
24
 */
25
class ProductSetPricesAction extends AbstractAction
26
{
27
    public function fieldDefinitions()
28
    {
29
        return [
30
            'action' => [static::TYPE => 'string'],
31
            'variantId' => [static::TYPE => 'int'],
32
            'prices' => [static::TYPE => '\Commercetools\Core\Model\Common\PriceDraftCollection'],
33
            'staged' => [static::TYPE => 'bool'],
34
        ];
35
    }
36
37
    /**
38
     * @param array $data
39
     * @param Context|callable $context
40
     */
41
    public function __construct(array $data = [], $context = null)
42
    {
43
        parent::__construct($data, $context);
44
        $this->setAction('setPrices');
45
    }
46
47
    /**
48
     * @param $variantId
49
     * @param PriceDraftCollection $prices
50
     * @param Context|callable $context
51
     * @return ProductSetPricesAction
52
     */
53
    public static function ofVariantIdAndPrices($variantId, PriceDraftCollection $prices, $context = null)
54
    {
55
        return static::of($context)->setVariantId($variantId)->setPrices($prices);
56
    }
57
}
58

src/Request/ProductTypes/Command/ProductTypeSetInputTipAction.php 1 location

@@ 22-52 (lines=31) @@
19
 * @method LocalizedString getInputTip()
20
 * @method ProductTypeSetInputTipAction setInputTip(LocalizedString $inputTip = null)
21
 */
22
class ProductTypeSetInputTipAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'attributeName' => [static::TYPE => 'string'],
29
            'inputTip' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('setInputTip');
41
    }
42
43
    /**
44
     * @param string $attributeName
45
     * @param Context|callable $context
46
     * @return static
47
     */
48
    public static function ofAttributeName($attributeName, $context = null)
49
    {
50
        return static::of($context)->setAttributeName($attributeName);
51
    }
52
}
53

src/Request/ProductTypes/Command/ProductTypeChangeIsSearchableAction.php 1 location

@@ 22-53 (lines=32) @@
19
 * @method bool getIsSearchable()
20
 * @method ProductTypeChangeIsSearchableAction setIsSearchable(bool $isSearchable = null)
21
 */
22
class ProductTypeChangeIsSearchableAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'attributeName' => [static::TYPE => 'string'],
29
            'isSearchable' => [static::TYPE => 'bool']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('changeIsSearchable');
41
    }
42
43
    /**
44
     * @param string $attributeName
45
     * @param bool $isSearchable
46
     * @param Context|callable $context
47
     * @return ProductTypeChangeIsSearchableAction
48
     */
49
    public static function ofAttributeNameAndIsSearchable($attributeName, $isSearchable, $context = null)
50
    {
51
        return static::of($context)->setAttributeName($attributeName)->setIsSearchable($isSearchable);
52
    }
53
}
54

src/Request/Types/Command/TypeAddEnumValueAction.php 1 location

@@ 22-53 (lines=32) @@
19
 * @method Enum getValue()
20
 * @method TypeAddEnumValueAction setValue(Enum $value = null)
21
 */
22
class TypeAddEnumValueAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'fieldName' => [static::TYPE => 'string'],
29
            'value' => [static::TYPE => '\Commercetools\Core\Model\Common\Enum']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('addEnumValue');
41
    }
42
43
    /**
44
     * @param string $fieldName
45
     * @param Enum $enum
46
     * @param Context|callable $context
47
     * @return TypeAddEnumValueAction
48
     */
49
    public static function ofNameAndEnum($fieldName, Enum $enum, $context = null)
50
    {
51
        return static::of($context)->setFieldName($fieldName)->setValue($enum);
52
    }
53
}
54

src/Request/Types/Command/TypeAddLocalizedEnumValueAction.php 1 location

@@ 22-53 (lines=32) @@
19
 * @method LocalizedEnum getValue()
20
 * @method TypeAddLocalizedEnumValueAction setValue(LocalizedEnum $value = null)
21
 */
22
class TypeAddLocalizedEnumValueAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'fieldName' => [static::TYPE => 'string'],
29
            'value' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedEnum']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('addLocalizedEnumValue');
41
    }
42
43
    /**
44
     * @param string $fieldName
45
     * @param LocalizedEnum $enum
46
     * @param Context|callable $context
47
     * @return TypeAddLocalizedEnumValueAction
48
     */
49
    public static function ofNameAndEnum($fieldName, LocalizedEnum $enum, $context = null)
50
    {
51
        return static::of($context)->setFieldName($fieldName)->setValue($enum);
52
    }
53
}
54

src/Request/Types/Command/TypeChangeEnumValueOrderAction.php 1 location

@@ 22-53 (lines=32) @@
19
 * @method array getKeys()
20
 * @method TypeChangeEnumValueOrderAction setKeys(array $keys = null)
21
 */
22
class TypeChangeEnumValueOrderAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'fieldName' => [static::TYPE => 'string'],
29
            'keys' => [static::TYPE => 'array']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('changeEnumValueOrder');
41
    }
42
43
    /**
44
     * @param string $fieldName
45
     * @param array $keys
46
     * @param Context|callable $context
47
     * @return TypeChangeEnumValueOrderAction
48
     */
49
    public static function ofNameAndEnums($fieldName, array $keys, $context = null)
50
    {
51
        return static::of($context)->setFieldName($fieldName)->setKeys($keys);
52
    }
53
}
54

src/Request/Types/Command/TypeChangeLabelAction.php 1 location

@@ 22-53 (lines=32) @@
19
 * @method LocalizedString getLabel()
20
 * @method TypeChangeLabelAction setLabel(LocalizedString $label = null)
21
 */
22
class TypeChangeLabelAction extends AbstractAction
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'action' => [static::TYPE => 'string'],
28
            'fieldName' => [static::TYPE => 'string'],
29
            'label' => [static::TYPE => '\Commercetools\Core\Model\Common\LocalizedString']
30
        ];
31
    }
32
33
    /**
34
     * @param array $data
35
     * @param Context|callable $context
36
     */
37
    public function __construct(array $data = [], $context = null)
38
    {
39
        parent::__construct($data, $context);
40
        $this->setAction('changeLabel');
41
    }
42
43
    /**
44
     * @param string $fieldname
45
     * @param LocalizedString $label
46
     * @param Context|callable $context
47
     * @return TypeChangeLabelAction
48
     */
49
    public static function ofNameAndLabel($fieldname, LocalizedString $label, $context = null)
50
    {
51
        return static::of($context)->setFieldName($fieldname)->setLabel($label);
52
    }
53
}
54

src/Request/Types/Command/TypeChangeLocalizedEnumValueOrderAction.php 1 location

@@ 23-54 (lines=32) @@
20
 * @method array getKeys()
21
 * @method TypeChangeLocalizedEnumValueOrderAction setKeys(array $keys = null)
22
 */
23
class TypeChangeLocalizedEnumValueOrderAction extends AbstractAction
24
{
25
    public function fieldDefinitions()
26
    {
27
        return [
28
            'action' => [static::TYPE => 'string'],
29
            'fieldName' => [static::TYPE => 'string'],
30
            'keys' => [static::TYPE => 'array']
31
        ];
32
    }
33
34
    /**
35
     * @param array $data
36
     * @param Context|callable $context
37
     */
38
    public function __construct(array $data = [], $context = null)
39
    {
40
        parent::__construct($data, $context);
41
        $this->setAction('changeLocalizedEnumValueOrder');
42
    }
43
44
    /**
45
     * @param string $fieldName
46
     * @param array $keys
47
     * @param Context|callable $context
48
     * @return TypeChangeLocalizedEnumValueOrderAction
49
     */
50
    public static function ofNameAndEnums($fieldName, array $keys, $context = null)
51
    {
52
        return static::of($context)->setFieldName($fieldName)->setKeys($keys);
53
    }
54
}
55