ClaimCheck::getS3BucketName()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 4
rs 10
ccs 2
cts 2
cp 1
nc 1
cc 1
eloc 2
nop 0
crap 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