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.
Completed
Pull Request — master (#9)
by Gallice
02:36
created

Attachment::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 7
ccs 4
cts 4
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 0
crap 1
1
<?php
2
3
namespace Tgallice\FBMessenger\Model;
4
5
use Tgallice\FBMessenger\Model\Attachment\Template;
6
7
class Attachment implements \JsonSerializable
8
{
9
    const TYPE_IMAGE = 'image';
10
    const TYPE_FILE = 'file';
11
12
    const TYPE_TEMPLATE = 'template';
13
14
    /**
15
     * @var string
16
     */
17
    private $type;
18
19
    /**
20
     * @var array|Template
21
     */
22
    private $payload;
23
24
    /**
25
     * Attachment constructor.
26
     *
27
     * @param $type
28
     * @param array|Template $payload
29
     */
30 17
    public function __construct($type, $payload = [])
31
    {
32 17
        $this->type = $type;
33 17
        $this->payload = $payload;
34 17
    }
35
36
    /**
37
     * @return string
38
     */
39 4
    public function getType()
40
    {
41 4
        return $this->type;
42
    }
43
44
    /**
45
     * @return array|Template
46
     */
47 3
    public function getPayload()
48
    {
49 3
        return $this->payload;
50
    }
51
52
    /**
53
     * @return array
54
     */
55 1
    public function jsonSerialize()
56
    {
57
        return [
58 1
            'type' => $this->type,
59 1
            'payload' => $this->payload,
60 1
        ];
61
    }
62
}
63