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.

QuickReply   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 62
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 62
ccs 16
cts 16
cp 1
rs 10
c 1
b 0
f 0

5 Methods

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