SnsExtendedClientConfiguration   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 99
Duplicated Lines 14.14 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 10
c 1
b 0
f 1
lcom 0
cbo 5
dl 14
loc 99
rs 10
ccs 31
cts 31
cp 1

9 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 14 14 2
A getS3Client() 0 4 1
A setS3Client() 0 4 1
A getS3BucketName() 0 4 1
A setS3BucketName() 0 4 1
A getClaimCheckFactory() 0 4 1
A setClaimCheckFactory() 0 4 1
A getClaimCheckSerializer() 0 4 1
A setClaimCheckSerializer() 0 4 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
namespace Abacaphiliac\AwsSdk\ClaimCheck\Sns;
4
5
use Abacaphiliac\AwsSdk\ClaimCheck\ClaimCheckFactory;
6
use Abacaphiliac\AwsSdk\ClaimCheck\ClaimCheckFactoryInterface;
7
use Abacaphiliac\AwsSdk\ClaimCheck\Exception\ExceptionInterface;
8
use Abacaphiliac\AwsSdk\ClaimCheck\Exception\InvalidArgumentException;
9
use Abacaphiliac\AwsSdk\ClaimCheck\Serializer\ClaimCheckJsonSerializer;
10
use Abacaphiliac\AwsSdk\ClaimCheck\Serializer\ClaimCheckSerializerChain;
11
use Abacaphiliac\AwsSdk\ClaimCheck\Serializer\ClaimCheckSerializerInterface;
12
use Abacaphiliac\AwsSdk\ClaimCheck\Serializer\JsonSnsMessageSerializer;
13
use Aws\S3\S3Client;
14
15
class SnsExtendedClientConfiguration
16
{
17
    /** @var  S3Client */
18
    private $s3Client;
19
    
20
    /** @var  string */
21
    private $s3BucketName;
22
    
23
    /** @var  ClaimCheckFactoryInterface */
24
    private $claimCheckFactory;
25
    
26
    /** @var  ClaimCheckSerializerInterface */
27
    private $claimCheckSerializer;
28
29
    /**
30
     * ExtendedClientConfiguration constructor.
31
     * @param S3Client $s3Client
32
     * @param string $s3BucketName
33
     * @throws ExceptionInterface
34
     */
35 7 View Code Duplication
    public function __construct(S3Client $s3Client, $s3BucketName)
0 ignored issues
show
Duplication introduced by
This method 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...
36
    {
37 7
        if (!$s3BucketName) {
38 2
            throw new InvalidArgumentException('S3 Bucket Name is required and cannot be empty.');
39
        }
40
        
41 7
        $this->s3Client = $s3Client;
42 7
        $this->s3BucketName = $s3BucketName;
43 7
        $this->claimCheckFactory = new ClaimCheckFactory($s3BucketName);
44 7
        $this->claimCheckSerializer = new ClaimCheckSerializerChain(array(
45 7
            new ClaimCheckJsonSerializer(),
46 7
            new JsonSnsMessageSerializer(),
47 7
        ));
48 7
    }
49
50
    /**
51
     * @return S3Client
52
     */
53 2
    public function getS3Client()
54
    {
55 2
        return $this->s3Client;
56
    }
57
58
    /**
59
     * @param S3Client $s3Client
60
     */
61 1
    public function setS3Client($s3Client)
62
    {
63 1
        $this->s3Client = $s3Client;
64 1
    }
65
66
    /**
67
     * @return string
68
     */
69 2
    public function getS3BucketName()
70
    {
71 2
        return $this->s3BucketName;
72
    }
73
74
    /**
75
     * @param string $s3BucketName
76
     */
77 1
    public function setS3BucketName($s3BucketName)
78
    {
79 1
        $this->s3BucketName = $s3BucketName;
80 1
    }
81
82
    /**
83
     * @return ClaimCheckFactoryInterface
84
     */
85 2
    public function getClaimCheckFactory()
86
    {
87 2
        return $this->claimCheckFactory;
88
    }
89
90
    /**
91
     * @param ClaimCheckFactoryInterface $claimCheckFactory
92
     */
93 1
    public function setClaimCheckFactory($claimCheckFactory)
94
    {
95 1
        $this->claimCheckFactory = $claimCheckFactory;
96 1
    }
97
98
    /**
99
     * @return ClaimCheckSerializerInterface
100
     */
101 2
    public function getClaimCheckSerializer()
102
    {
103 2
        return $this->claimCheckSerializer;
104
    }
105
106
    /**
107
     * @param ClaimCheckSerializerInterface $claimCheckSerializer
108
     */
109 1
    public function setClaimCheckSerializer(ClaimCheckSerializerInterface $claimCheckSerializer)
110
    {
111 1
        $this->claimCheckSerializer = $claimCheckSerializer;
112 1
    }
113
}
114