Passed
Push — develop ( e75002...49ff19 )
by Jens
08:50
created

GoogleCloudPubSubDestination   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Test Coverage

Coverage 66.67%

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 20
ccs 4
cts 6
cp 0.6667
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A ofProjectIdAndTopic() 0 3 1
A fieldDefinitions() 0 6 1
1
<?php
2
/**
3
 */
4
5
namespace Commercetools\Core\Model\Subscription;
6
7
use Commercetools\Core\Model\Common\Context;
8
9
/**
10
 * @package Commercetools\Core\Model\Subscription
11
 *
12
 * @method string getType()
13
 * @method GoogleCloudPubSubDestination setType(string $type = null)
14
 * @method string getProjectId()
15
 * @method GoogleCloudPubSubDestination setProjectId(string $projectId = null)
16
 * @method string getTopic()
17
 * @method GoogleCloudPubSubDestination setTopic(string $topic = null)
18
 */
19
class GoogleCloudPubSubDestination extends Destination
20
{
21 1
    public function fieldDefinitions()
22
    {
23
        return [
24 1
            'type' => [static::TYPE => 'string'],
25 1
            'projectId' => [static::TYPE => 'string'],
26 1
            'topic' => [static::TYPE => 'string'],
27
        ];
28
    }
29
30
    /**
31
     * @param string $projectId
32
     * @param string $topic
33
     * @param Context $context
34
     * @return GoogleCloudPubSubDestination
35
     */
36
    public static function ofProjectIdAndTopic($projectId, $topic, Context $context = null)
37
    {
38
        return static::of($context)->setType('GoogleCloudPubSub')->setProjectId($projectId)->setTopic($topic);
39
    }
40
}
41