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.

Text::jsonSerialize()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 12
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 8
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 12
ccs 8
cts 8
cp 1
rs 9.4285
cc 2
eloc 7
nc 2
nop 0
crap 2
1
<?php
2
3
namespace Tgallice\FBMessenger\Model\QuickReply;
4
5
use Tgallice\FBMessenger\Model\QuickReply;
6
7
class Text extends QuickReply
8
{
9
    /**
10
     * @var string
11
     */
12
    private $title;
13
14
    /**
15
     * Payload
16
     *
17
     * @var string
18
     */
19
    private $payload;
20
    
21
    /**
22
     * @var string
23
     */
24
    private $image_url;
25
    
26
    /**
27
     * @param string $title
28
     * @param string $payload
29
     */
30 9
    public function __construct($title, $payload, $image_url = null)
31
    {
32 9
        parent::__construct(QuickReply::TYPE_TEXT);
33
    
34 9
        self::validateTitleSize($title);
35 8
        $this->title = $title;
36
    
37 8
        QuickReply::validatePayload($payload);
38 7
        $this->payload = $payload;
39
        
40 7
        $this->image_url = $image_url;
41 7
    }
42
    
43
    /**
44
     * @return string
45
     */
46 1
    public function getTitle()
47
    {
48 1
        return $this->title;
49
    }
50
    
51
    /**
52
     * @return string
53
     */
54 1
    public function getPayload()
55
    {
56 1
        return $this->payload;
57
    }
58
    
59
    /**
60
     * @return string
61
     */
62
    public function getImageUrl()
63
    {
64
        return $this->image_url;
65
    }
66
    
67
    /**
68
     * @inheritdoc
69
     */
70 2
    public function jsonSerialize()
71
    {
72 2
        $json = parent::jsonSerialize();
73 2
        $json['title'] = $this->title;
74 2
        $json['payload'] = $this->payload;
75
    
76 2
        if(!empty($this->image_url)) {
77 1
            $json['image_url'] = $this->image_url;
78 1
        }
79
        
80 2
        return $json;
81
    }
82
}
83