Completed
Push — master ( 18bfc7...82e0b5 )
by Jens
18:00 queued 05:19
created

SNSDestination::fieldDefinitions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 9
ccs 0
cts 9
cp 0
rs 9.6666
cc 1
eloc 6
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\Context;
9
10
/**
11
 * @package Commercetools\Core\Model\Subscription
12
 *
13
 * @method string getType()
14
 * @method SNSDestination setType(string $type = null)
15
 * @method string getTopicArn()
16
 * @method SNSDestination setTopicArn(string $topicArn = null)
17
 * @method string getAccessKey()
18
 * @method SNSDestination setAccessKey(string $accessKey = null)
19
 * @method string getAccessSecret()
20
 * @method SNSDestination setAccessSecret(string $accessSecret = null)
21
 */
22
class SNSDestination extends Destination
23
{
24
    public function fieldDefinitions()
25
    {
26
        return [
27
            'type' => [static::TYPE => 'string'],
28
            'topicArn' => [static::TYPE => 'string'],
29
            'accessKey' => [static::TYPE => 'string'],
30
            'accessSecret' => [static::TYPE => 'string'],
31
        ];
32
    }
33
34
    /**
35
     * @param string $topicArn
36
     * @param string $accessKey
37
     * @param string $accessSecret
38
     * @param Context|null $context
39
     * @return SNSDestination
40
     */
41
    public static function ofTopicArnAccessKeyAndSecret($topicArn, $accessKey, $accessSecret, Context $context = null)
42
    {
43
        return static::of($context)->setType('SNS')
44
            ->setTopicArn($topicArn)->setAccessKey($accessKey)->setAccessSecret($accessSecret);
45
    }
46
}
47