Completed
Push — develop ( 57e803...58ad97 )
by Jens
36:22 queued 12:33
created

AzureServiceBusDestination   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 1
dl 24
loc 24
ccs 0
cts 13
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A fieldDefinitions() 7 7 1
A ofQueueURLAccessKeyAndSecret() 6 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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 AzureServiceBusDestination setType(string $type = null)
15
 * @method string getConnectionString()
16
 * @method AzureServiceBusDestination setConnectionString(string $connectionString = null)
17
 */
18 View Code Duplication
class AzureServiceBusDestination extends Destination
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
19
{
20
    public function fieldDefinitions()
21
    {
22
        return [
23
            'type' => [static::TYPE => 'string'],
24
            'connectionString' => [static::TYPE => 'string'],
25
        ];
26
    }
27
28
    /**
29
     * @param $connectionString
30
     * @param $accessKey
31
     * @param $accessSecret
32
     * @param Context|null $context
33
     * @return AzureServiceBusDestination
34
     */
35
    public static function ofQueueURLAccessKeyAndSecret($connectionString, Context $context = null)
36
    {
37
        return static::of($context)
38
            ->setType('AzureServiceBus')
39
            ->setConnectionString($connectionString);
40
    }
41
}
42