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#lineitemstatetransition-message |
16
|
|
|
* @method string getId() |
17
|
|
|
* @method LineItemStateTransitionMessage setId(string $id = null) |
18
|
|
|
* @method DateTimeDecorator getCreatedAt() |
19
|
|
|
* @method LineItemStateTransitionMessage setCreatedAt(DateTime $createdAt = null) |
20
|
|
|
* @method int getSequenceNumber() |
21
|
|
|
* @method LineItemStateTransitionMessage setSequenceNumber(int $sequenceNumber = null) |
22
|
|
|
* @method Reference getResource() |
23
|
|
|
* @method LineItemStateTransitionMessage setResource(Reference $resource = null) |
24
|
|
|
* @method int getResourceVersion() |
25
|
|
|
* @method LineItemStateTransitionMessage setResourceVersion(int $resourceVersion = null) |
26
|
|
|
* @method string getType() |
27
|
|
|
* @method LineItemStateTransitionMessage setType(string $type = null) |
28
|
|
|
* @method string getLineItemId() |
29
|
|
|
* @method LineItemStateTransitionMessage setLineItemId(string $lineItemId = null) |
30
|
|
|
* @method DateTimeDecorator getTransitionDate() |
31
|
|
|
* @method LineItemStateTransitionMessage setTransitionDate(DateTime $transitionDate = null) |
32
|
|
|
* @method int getQuantity() |
33
|
|
|
* @method LineItemStateTransitionMessage setQuantity(int $quantity = null) |
34
|
|
|
* @method StateReference getFromState() |
35
|
|
|
* @method LineItemStateTransitionMessage setFromState(StateReference $fromState = null) |
36
|
|
|
* @method StateReference getToState() |
37
|
|
|
* @method LineItemStateTransitionMessage setToState(StateReference $toState = null) |
38
|
|
|
* @method int getVersion() |
39
|
|
|
* @method LineItemStateTransitionMessage setVersion(int $version = null) |
40
|
|
|
* @method DateTimeDecorator getLastModifiedAt() |
41
|
|
|
* @method LineItemStateTransitionMessage setLastModifiedAt(DateTime $lastModifiedAt = null) |
42
|
|
|
*/ |
43
|
|
View Code Duplication |
class LineItemStateTransitionMessage extends Message |
|
|
|
|
44
|
|
|
{ |
45
|
|
|
const MESSAGE_TYPE = 'LineItemStateTransition'; |
46
|
|
|
|
47
|
1 |
|
public function fieldDefinitions() |
48
|
|
|
{ |
49
|
1 |
|
$definitions = array_merge( |
50
|
1 |
|
parent::fieldDefinitions(), |
51
|
|
|
[ |
52
|
1 |
|
'lineItemId' => [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.