Passed
Push — master ( 18b32f...fa2b73 )
by Jens
08:15
created

GoogleCloudPubSubDestination   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 22
Duplicated Lines 0 %

Test Coverage

Coverage 50%

Importance

Changes 0
Metric Value
wmc 2
eloc 8
dl 0
loc 22
ccs 4
cts 8
cp 0.5
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 0 6 1
A ofProjectIdAndTopic() 0 5 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(static::DESTINATION_GOOGLE_CLOUD_PUB_SUB)
39
            ->setProjectId($projectId)
40
            ->setTopic($topic);
41
    }
42
}
43