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

Referral   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 65
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 0
dl 0
loc 65
rs 10
c 0
b 0
f 0

5 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A getRef() 0 4 1
A getSource() 0 4 1
A getType() 0 4 1
A create() 0 4 1
1
<?php
2
namespace Kerox\Messenger\Model\Callback;
3
4
class Referral
5
{
6
7
    /**
8
     * @var mixed
9
     */
10
    protected $ref;
11
12
    /**
13
     * @var string
14
     */
15
    protected $source;
16
17
    /**
18
     * @var string
19
     */
20
    protected $type;
21
22
    /**
23
     * Referral constructor.
24
     *
25
     * @param $ref
26
     * @param string $source
27
     * @param string $type
28
     */
29
    public function __construct($ref, string $source, string $type)
30
    {
31
        $this->ref = $ref;
32
        $this->source = $source;
33
        $this->type = $type;
34
    }
35
36
    /**
37
     * @return mixed
38
     */
39
    public function getRef()
40
    {
41
        return $this->ref;
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getSource(): string
48
    {
49
        return $this->source;
50
    }
51
52
    /**
53
     * @return string
54
     */
55
    public function getType(): string
56
    {
57
        return $this->type;
58
    }
59
60
    /**
61
     * @param array $payload
62
     * @return static
63
     */
64
    public static function create(array $payload)
65
    {
66
        return new static($payload['ref'], $payload['source'], $payload['type']);
67
    }
68
}
69