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 ( ac5cf0...399d31 )
by Gallice
03:08
created

DefaultAction   A

Complexity

Total Complexity 10

Size/Duplication

Total Lines 97
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 10
lcom 1
cbo 0
dl 0
loc 97
c 0
b 0
f 0
ccs 28
cts 28
cp 1
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 1
A getUrl() 0 4 1
A getWebviewHeightRatio() 0 4 1
A getFallbackUrl() 0 4 1
A useMessengerExtensions() 0 4 1
B jsonSerialize() 0 21 5
1
<?php
2
3
namespace Tgallice\FBMessenger\Model;
4
5
class DefaultAction implements \JsonSerializable
6
{
7
    const HEIGHT_RATIO_FULL = 'full';
8
    const HEIGHT_RATIO_COMPACT = 'compact';
9
    const HEIGHT_RATIO_TALL = 'tall';
10
11
    /**
12
     * @var string
13
     */
14
    private $url;
15
16
    /**
17
     * @var string
18
     */
19
    private $webviewHeightRatio;
20
21
    /**
22
     * @var bool
23
     */
24
    private $messengerExtensions = false;
25
26
    /**
27
     * @var string|null
28
     */
29
    public $fallbackUrl;
30
31
    /**
32
     * @param string $url
33
     * @param string $webviewHeghtRatio
34
     * @param bool $messengerExtensions
35
     * @param null|string $fallbaclUrl
36
     */
37 7
    public function __construct($url, $webviewHeghtRatio = self::HEIGHT_RATIO_FULL, $messengerExtensions = false, $fallbaclUrl = null)
38
    {
39 7
        $this->url = $url;
40 7
        $this->webviewHeightRatio = $webviewHeghtRatio;
41 7
        $this->messengerExtensions = (bool) $messengerExtensions;
42 7
        $this->fallbackUrl = $fallbaclUrl;
43 7
    }
44
45
    /**
46
     * @return string
47
     */
48 1
    public function getUrl()
49
    {
50 1
        return $this->url;
51
    }
52
53
    /**
54
     * @return string|null
55
     */
56 1
    public function getWebviewHeightRatio()
57
    {
58 1
        return $this->webviewHeightRatio;
59
    }
60
61
    /**
62
     * @return string|null
63
     */
64 1
    public function getFallbackUrl()
65
    {
66 1
        return $this->fallbackUrl;
67
    }
68
69
    /**
70
     * @return bool
71
     */
72 1
    public function useMessengerExtensions()
73
    {
74 1
        return $this->messengerExtensions;
75
    }
76
77
    /**
78
     * @inheritdoc
79
     */
80 2
    public function jsonSerialize()
81
    {
82
        $json = [
83 2
            'type' => 'web_url',
84 2
            'url' => $this->url,
85 2
        ];
86
87 2
        if (!empty($this->webviewHeightRatio)) {
88 2
            $json['webview_height_ratio'] = $this->webviewHeightRatio;
89 2
        }
90
91 2
        if ($this->messengerExtensions) {
92 1
            $json['messenger_extensions'] = $this->messengerExtensions;
93 1
        }
94
95 2
        if ($this->messengerExtensions && !empty($this->fallbackUrl)) {
96 1
            $json['fallback_url'] = $this->fallbackUrl;
97 1
        }
98
99 2
        return $json;
100
    }
101
}
102