AccountLinking   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 46
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

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

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A getStatus() 0 4 1
A hasAuthorizationCode() 0 4 1
A getAuthorizationCode() 0 4 1
A create() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Callback;
6
7
class AccountLinking
8
{
9
    /**
10
     * @var string
11
     */
12
    protected $status;
13
14
    /**
15
     * @var string|null
16
     */
17
    protected $authorizationCode;
18
19
    /**
20
     * AccountLinking constructor.
21
     */
22 1
    public function __construct(string $status, ?string $authorizationCode = null)
23
    {
24 1
        $this->status = $status;
25 1
        $this->authorizationCode = $authorizationCode;
26 1
    }
27
28 1
    public function getStatus(): string
29
    {
30 1
        return $this->status;
31
    }
32
33 1
    public function hasAuthorizationCode(): bool
34
    {
35 1
        return $this->authorizationCode !== null;
36
    }
37
38 1
    public function getAuthorizationCode(): ?string
39
    {
40 1
        return $this->authorizationCode;
41
    }
42
43
    /**
44
     * @return \Kerox\Messenger\Model\Callback\AccountLinking
45
     */
46 1
    public static function create(array $callbackData): self
47
    {
48 1
        $authorizationCode = $callbackData['authorization_code'] ?? null;
49
50 1
        return new self($callbackData['status'], $authorizationCode);
51
    }
52
}
53