Completed
Pull Request — master (#3)
by Romain
01:42
created

AccountLinking   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 0
dl 0
loc 52
rs 10
c 0
b 0
f 0

4 Methods

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