Completed
Push — develop ( fe4302...d9652d )
by Jens
14:25 queued 03:33
created

MessageDelivery::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 22
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 22
ccs 0
cts 0
cp 0
rs 9.2
c 0
b 0
f 0
cc 1
eloc 15
nc 1
nop 0
crap 2
1
<?php
2
/**
3
 * @author @jayS-de <[email protected]>
4
 */
5
6
namespace Commercetools\Core\Model\Subscription;
7
8
use Commercetools\Core\Model\Common\Reference;
9
use Commercetools\Core\Model\Common\DateTimeDecorator;
10
use Commercetools\Core\Model\Message\Message;
11
use DateTime;
12
13
/**
14
 * @package Commercetools\Core\Model\Subscription
15
 * @method string getProjectKey()
16
 * @method MessageDelivery setProjectKey(string $projectKey = null)
17
 * @method string getNotificationType()
18
 * @method MessageDelivery setNotificationType(string $notificationType = null)
19
 * @method Reference getResource()
20
 * @method MessageDelivery setResource(Reference $resource = null)
21
 * @method string getId()
22
 * @method MessageDelivery setId(string $id = null)
23
 * @method int getVersion()
24
 * @method MessageDelivery setVersion(int $version = null)
25
 * @method int getSequenceNumber()
26
 * @method MessageDelivery setSequenceNumber(int $sequenceNumber = null)
27
 * @method int getResourceVersion()
28
 * @method MessageDelivery setResourceVersion(int $resourceVersion = null)
29
 * @method DateTimeDecorator getCreatedAt()
30
 * @method MessageDelivery setCreatedAt(DateTime $createdAt = null)
31
 * @method DateTimeDecorator getLastModifiedAt()
32
 * @method MessageDelivery setLastModifiedAt(DateTime $lastModifiedAt = null)
33
 */
34
class MessageDelivery extends Delivery
35
{
36
    public function fieldDefinitions()
37
    {
38
        $definition = parent::fieldDefinitions();
39
        $definition = array_merge(
40
            $definition,
41
            [
42
                'id' => [static::TYPE => 'string'],
43
                'version' => [static::TYPE => 'int'],
44
                'sequenceNumber' => [static::TYPE => 'int'],
45
                'resourceVersion' => [static::TYPE => 'int'],
46
                'createdAt' => [
47
                    static::TYPE => DateTime::class,
48
                    static::DECORATOR => DateTimeDecorator::class
49
                ],
50
                'lastModifiedAt' => [
51
                    static::TYPE => DateTime::class,
52
                    static::DECORATOR => DateTimeDecorator::class
53
                ],
54
            ]
55
        );
56
        return $definition;
57
    }
58
59 2
    public function getMessage()
60
    {
61 2
        return Message::fromArray($this->rawData);
62
    }
63
}
64