GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Passed
Push — master ( e6911b...12118e )
by Gallice
04:03
created

Postback   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 58
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
lcom 1
cbo 1
dl 0
loc 58
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 getPayload() 0 4 1
A getReferral() 0 4 1
A hasReferral() 0 4 1
A create() 0 6 2
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\Callback;
4
5
class Postback
6
{
7
    /**
8
     * @var string
9
     */
10
    private $payload;
11
12
    /**
13
     * @var Referral|null
14
     */
15
    private $referral;
16
17
    /**
18
     * @param string $payload
19
     * @param Referral|null $referral
20
     */
21 5
    public function __construct($payload, Referral $referral = null)
22
    {
23 5
        $this->payload = $payload;
24 5
        $this->referral = $referral;
25 5
    }
26
27
    /**
28
     * @return string
29
     */
30 1
    public function getPayload()
31
    {
32 1
        return $this->payload;
33
    }
34
35
    /**
36
     * @return Referral|null
37
     */
38 2
    public function getReferral()
39
    {
40 2
        return $this->referral;
41
    }
42
43
    /**
44
     * @return boolean
45
     */
46 1
    public function hasReferral()
47
    {
48 1
        return $this->referral !== null;
49
    }
50
51
    /**
52
     * @param array $payload
53
     *
54
     * @return static
55
     */
56 1
    public static function create(array $payload)
57
    {
58 1
        $referral = isset($payload['referral']) ? Referral::create($payload['referral']) : null;
59
60 1
        return new static($payload['payload'], $referral);
61
    }
62
}
63