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

AzureServiceBusDestination   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Test Coverage

Coverage 35.7%

Importance

Changes 0
Metric Value
wmc 3
eloc 13
dl 0
loc 36
ccs 5
cts 14
cp 0.357
rs 10
c 0
b 0
f 0

3 Methods

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 0 7 1
A ofUriAndAccessKey() 0 6 1
A ofQueueURLAccessKeyAndSecret() 0 5 1
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