ClaimCheck   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 4
c 1
b 0
f 1
lcom 0
cbo 2
dl 0
loc 40
rs 10
ccs 11
cts 11
cp 1

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 2
A getS3BucketName() 0 4 1
A getS3Key() 0 4 1
1
<?php
2
3
namespace Abacaphiliac\AwsSdk\ClaimCheck;
4
5
use Ramsey\Uuid\Uuid;
6
7
class ClaimCheck
8
{
9
    /** @var  string */
10
    private $s3BucketName;
11
    
12
    /** @var  string */
13
    private $s3Key;
14
15
    /**
16
     * ClaimCheckMessage constructor.
17
     * @param string $s3BucketName
18
     * @param string $s3Key
19
     */
20 17
    public function __construct($s3BucketName, $s3Key = null)
21
    {
22 17
        $this->s3BucketName = $s3BucketName;
23
        
24 17
        if (!$s3Key) {
0 ignored issues
show
Bug Best Practice introduced by
The expression $s3Key of type string|null is loosely compared to false; this is ambiguous if the string can be empty. You might want to explicitly use === null instead.

In PHP, under loose comparison (like ==, or !=, or switch conditions), values of different types might be equal.

For string values, the empty string '' is a special case, in particular the following results might be unexpected:

''   == false // true
''   == null  // true
'ab' == false // false
'ab' == null  // false

// It is often better to use strict comparison
'' === false // false
'' === null  // false
Loading history...
25 5
            $s3Key = Uuid::uuid4()->toString();
26 5
        }
27
        
28 17
        $this->s3Key = $s3Key;
29 17
    }
30
31
    /**
32
     * @return string
33
     */
34 10
    public function getS3BucketName()
35
    {
36 10
        return $this->s3BucketName;
37
    }
38
39
    /**
40
     * @return string
41
     */
42 11
    public function getS3Key()
43
    {
44 11
        return $this->s3Key;
45
    }
46
}
47