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 ( 6cf912...554d1b )
by Gallice
03:11
created

QuickReply::getContentType()   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;
4
5
abstract class QuickReply implements \JsonSerializable
6
{
7
    const TYPE_TEXT = 'text';
8
    const TYPE_LOCATION = 'location';
9
    
10
    /**
11
     * @var string
12
     */
13
    private $contentType;
14
15
    /**
16
     * @param string $contentType TYPE_*
17
     */
18 13
    public function __construct($contentType)
19
    {
20 13
        $this->contentType = $contentType;
21 13
    }
22
23
    /**
24
     * @return string
25
     */
26 2
    public function getContentType()
27
    {
28 2
        return $this->contentType;
29
    }
30
    
31
    /**
32
     * @inheritdoc
33
     */
34 3
    public function jsonSerialize()
35
    {
36
        return [
37 3
            'content_type' => $this->contentType,
38 3
        ];
39
    }
40
    
41
    /**
42
     * @param string $title
43
     *
44
     * @throws \InvalidArgumentException
45
     */
46 9
    public static function validateTitleSize($title)
47
    {
48 9
        if (mb_strlen($title) > 20) {
49 1
            throw new \InvalidArgumentException('The button title field should not exceed 20 characters.');
50
        }
51 8
    }
52
    
53
    /**
54
     * @param $payload
55
     *
56
     * @throws \InvalidArgumentException
57
     */
58 8
    public static function validatePayload($payload)
59
    {
60 8
        if (mb_strlen($payload) > 1000) {
61 1
            throw new \InvalidArgumentException(sprintf('Payload should not exceed 1000 characters.', $payload));
62
        }
63 7
    }
64
}
65