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.

Element::jsonSerialize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 10
Code Lines 7

Duplication

Lines 10
Ratio 100 %

Code Coverage

Tests 7
CRAP Score 2

Importance

Changes 0
Metric Value
dl 10
loc 10
c 0
b 0
f 0
ccs 7
cts 7
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\Attachment\Template\ElementList;
4
5
use Tgallice\FBMessenger\Model\Attachment\Template\AbstractElement;
6
use Tgallice\FBMessenger\Model\Button;
7
use Tgallice\FBMessenger\Model\DefaultAction;
8
9
class Element extends AbstractElement
10
{
11
    /**
12
     * @var null|Button
13
     */
14
    private $button;
15
16
    /**
17
     * @var null|DefaultAction
18
     */
19
    private $defaultAction;
20
21
    /**
22
     * @param string $title
23
     * @param null|string $subtitle
24
     * @param null|string $imageUrl
25
     * @param Button|null $button
26
     * @param DefaultAction|null $defaultAction
27
     */
28 8
    public function __construct($title, $subtitle = null, $imageUrl = null, Button $button = null, DefaultAction $defaultAction = null)
29
    {
30 8
        parent::__construct($title, $subtitle, $imageUrl);
31 6
        $this->button = $button;
32 6
        $this->defaultAction = $defaultAction;
33 6
    }
34
35 1
    public function getButton()
36
    {
37 1
        return $this->button;
38
    }
39
40 1
    public function getDefaultAction()
41
    {
42 1
        return $this->defaultAction;
43
    }
44
45
    /**
46
     * @return array
47
     */
48 1 View Code Duplication
    public function jsonSerialize()
49
    {
50
        return [
51 1
            'title' => $this->getTitle(),
52 1
            'subtitle' => $this->getSubtitle(),
53 1
            'image_url' => $this->getImageUrl(),
54 1
            'buttons' => $this->button ? [$this->button] : null,
55 1
            'default_action' => $this->defaultAction,
56 1
        ];
57
    }
58
}
59