Completed
Push — develop ( 641d0b...7172e1 )
by Jens
11:21
created

MessageDelivery   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 30
ccs 15
cts 15
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A getMessage() 0 4 1
A fieldDefinitions() 0 22 1
1
<?php
2
/**
3
 * @author @jenschude <[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 1
    public function fieldDefinitions()
37
    {
38 1
        $definition = parent::fieldDefinitions();
39 1
        $definition = array_merge(
40 1
            $definition,
41
            [
42 1
                'id' => [static::TYPE => 'string'],
43 1
                'version' => [static::TYPE => 'int'],
44 1
                'sequenceNumber' => [static::TYPE => 'int'],
45 1
                'resourceVersion' => [static::TYPE => 'int'],
46
                'createdAt' => [
47 1
                    static::TYPE => DateTime::class,
48 1
                    static::DECORATOR => DateTimeDecorator::class
49
                ],
50
                'lastModifiedAt' => [
51 1
                    static::TYPE => DateTime::class,
52 1
                    static::DECORATOR => DateTimeDecorator::class
53
                ],
54
            ]
55
        );
56 1
        return $definition;
57
    }
58
59 2
    public function getMessage()
60
    {
61 2
        return Message::fromArray($this->rawData);
62
    }
63
}
64