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

AzureServiceBusDestination::ofUriAndAccessKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 6
ccs 0
cts 5
cp 0
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 3
crap 2
1
<?php
2
/**
3
 * @author @jenschude <[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 AzureServiceBusDestination setType(string $type = null)
15
 * @method string getConnectionString()
16
 * @method AzureServiceBusDestination setConnectionString(string $connectionString = null)
17
 * @method string getUri()
18
 * @method AzureServiceBusDestination setUri(string $uri = null)
19
 * @method string getAccessKey()
20
 * @method AzureServiceBusDestination setAccessKey(string $accessKey = null)
21
 */
22
class AzureServiceBusDestination extends Destination
23
{
24 1
    public function fieldDefinitions()
25
    {
26
        return [
27 1
            'type' => [static::TYPE => 'string'],
28 1
            'connectionString' => [static::TYPE => 'string'],
29 1
            'uri' => [static::TYPE => 'string'],
30 1
            'accessKey' => [static::TYPE => 'string'],
31
        ];
32
    }
33
34
    /**
35
     * @param $connectionString
36
     * @param Context|null $context
37
     * @return AzureServiceBusDestination
38
     */
39
    public static function ofQueueURLAccessKeyAndSecret($connectionString, Context $context = null)
40
    {
41
        return static::of($context)
42
            ->setType('AzureServiceBus')
43
            ->setConnectionString($connectionString);
44
    }
45
46
    /**
47
     * @param $uri
48
     * @param $accessKey
49
     * @param Context|null $context
50
     * @return AzureServiceBusDestination
51
     */
52
    public static function ofUriAndAccessKey($uri, $accessKey, Context $context = null)
53
    {
54
        return static::of($context)
55
            ->setType('AzureServiceBus')
56
            ->setUri($uri)
57
            ->setAccessKey($accessKey);
58
    }
59
}
60