1
|
|
|
<?php |
2
|
|
|
/** |
3
|
|
|
* @author @jenschude <[email protected]> |
4
|
|
|
*/ |
5
|
|
|
|
6
|
|
|
namespace Commercetools\Core\Model\Message; |
7
|
|
|
|
8
|
|
|
use Commercetools\Core\Model\Common\DateTimeDecorator; |
9
|
|
|
use Commercetools\Core\Model\Common\Reference; |
10
|
|
|
use Commercetools\Core\Model\State\StateReference; |
11
|
|
|
use DateTime; |
12
|
|
|
|
13
|
|
|
/** |
14
|
|
|
* @package Commercetools\Core\Model\Message |
15
|
|
|
* @link https://docs.commercetools.com/http-api-projects-messages.html#customlineitemstatetransition-message |
16
|
|
|
* @method string getId() |
17
|
|
|
* @method CustomLineItemStateTransitionMessage setId(string $id = null) |
18
|
|
|
* @method DateTimeDecorator getCreatedAt() |
19
|
|
|
* @method CustomLineItemStateTransitionMessage setCreatedAt(DateTime $createdAt = null) |
20
|
|
|
* @method int getSequenceNumber() |
21
|
|
|
* @method CustomLineItemStateTransitionMessage setSequenceNumber(int $sequenceNumber = null) |
22
|
|
|
* @method Reference getResource() |
23
|
|
|
* @method CustomLineItemStateTransitionMessage setResource(Reference $resource = null) |
24
|
|
|
* @method int getResourceVersion() |
25
|
|
|
* @method CustomLineItemStateTransitionMessage setResourceVersion(int $resourceVersion = null) |
26
|
|
|
* @method string getType() |
27
|
|
|
* @method CustomLineItemStateTransitionMessage setType(string $type = null) |
28
|
|
|
* @method string getCustomLineItemId() |
29
|
|
|
* @method CustomLineItemStateTransitionMessage setCustomLineItemId(string $customLineItemId = null) |
30
|
|
|
* @method DateTimeDecorator getTransitionDate() |
31
|
|
|
* @method CustomLineItemStateTransitionMessage setTransitionDate(DateTime $transitionDate = null) |
32
|
|
|
* @method int getQuantity() |
33
|
|
|
* @method CustomLineItemStateTransitionMessage setQuantity(int $quantity = null) |
34
|
|
|
* @method StateReference getFromState() |
35
|
|
|
* @method CustomLineItemStateTransitionMessage setFromState(StateReference $fromState = null) |
36
|
|
|
* @method StateReference getToState() |
37
|
|
|
* @method CustomLineItemStateTransitionMessage setToState(StateReference $toState = null) |
38
|
|
|
* @method int getVersion() |
39
|
|
|
* @method CustomLineItemStateTransitionMessage setVersion(int $version = null) |
40
|
|
|
* @method DateTimeDecorator getLastModifiedAt() |
41
|
|
|
* @method CustomLineItemStateTransitionMessage setLastModifiedAt(DateTime $lastModifiedAt = null) |
42
|
|
|
*/ |
43
|
|
View Code Duplication |
class CustomLineItemStateTransitionMessage extends Message |
|
|
|
|
44
|
|
|
{ |
45
|
|
|
const MESSAGE_TYPE = 'CustomLineItemStateTransition'; |
46
|
|
|
|
47
|
1 |
|
public function fieldDefinitions() |
48
|
|
|
{ |
49
|
1 |
|
$definitions = array_merge( |
50
|
1 |
|
parent::fieldDefinitions(), |
51
|
|
|
[ |
52
|
1 |
|
'customLineItemId' => [static::TYPE => 'string'], |
53
|
|
|
'transitionDate' => [ |
54
|
1 |
|
static::TYPE => DateTime::class, |
55
|
1 |
|
static::DECORATOR => DateTimeDecorator::class |
56
|
|
|
], |
57
|
1 |
|
'quantity' => [static::TYPE => 'int'], |
58
|
1 |
|
'fromState' => [static::TYPE => StateReference::class], |
59
|
1 |
|
'toState' => [static::TYPE => StateReference::class], |
60
|
|
|
] |
61
|
|
|
); |
62
|
|
|
|
63
|
1 |
|
return $definitions; |
64
|
|
|
} |
65
|
|
|
} |
66
|
|
|
|
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.