Referral::getSource()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Kerox\Messenger\Model\Callback;
6
7
class Referral
8
{
9
    /**
10
     * @var string|null
11
     */
12
    protected $ref;
13
14
    /**
15
     * @var string|null
16
     */
17
    protected $source;
18
19
    /**
20
     * @var string|null
21
     */
22
    protected $type;
23
24
    /**
25
     * Referral constructor.
26
     */
27 2
    public function __construct(?string $ref, ?string $source, ?string $type)
28
    {
29 2
        $this->ref = $ref;
30 2
        $this->source = $source;
31 2
        $this->type = $type;
32 2
    }
33
34 1
    public function getRef(): ?string
35
    {
36 1
        return $this->ref;
37
    }
38
39 1
    public function getSource(): ?string
40
    {
41 1
        return $this->source;
42
    }
43
44 1
    public function getType(): ?string
45
    {
46 1
        return $this->type;
47
    }
48
49
    /**
50
     * @return \Kerox\Messenger\Model\Callback\Referral
51
     */
52 2
    public static function create(array $callbackData): self
53
    {
54 2
        $ref = $callbackData['ref'] ?? null;
55 2
        $source = $callbackData['source'] ?? null;
56 2
        $type = $callbackData['type'] ?? null;
57
58 2
        return new self($ref, $source, $type);
59
    }
60
}
61