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
Pull Request — master (#48)
by
unknown
03:29
created

Postback::getReferral()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

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
eloc 2
nc 1
nop 0
crap 1
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
14
	 */
15
	private $referral;
16
17
    /**
18
     * @param string $payload
19
	 * @param Referral $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
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