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.

FacebookPosterPost   A
last analyzed

Complexity

Total Complexity 8

Size/Duplication

Total Lines 99
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 10
Bugs 1 Features 0
Metric Value
wmc 8
eloc 19
c 10
b 1
f 0
dl 0
loc 99
ccs 12
cts 12
cp 1
rs 10

8 Methods

Rating   Name   Duplication   Size   Complexity  
A withParams() 0 5 1
A withMessage() 0 5 1
A getBody() 0 8 1
A __construct() 0 3 1
A getLink() 0 3 1
A withLink() 0 5 1
A getParams() 0 3 1
A getMessage() 0 3 1
1
<?php
2
3
namespace NotificationChannels\FacebookPoster;
4
5
class FacebookPosterPost
6
{
7
    /**
8
     * The post message.
9
     *
10
     * @var string
11
     */
12
    protected $message;
13
14
    /**
15
     * The post link.
16
     *
17
     * @var string
18
     */
19
    protected $link;
20
21
    /**
22
     * Additional post parameters.
23
     *
24
     * @var array
25
     */
26
    protected array $params = [];
27
28
    /**
29
     * Create a new post instance.
30
     *
31
     * @param  string  $message
32
     * @return void
33
     */
34
    public function __construct($message)
35
    {
36
        $this->message = $message;
37
    }
38
39
    /**
40
     * Set the post message.
41
     */
42
    public function withMessage(?string $message)
43
    {
44
        $this->message = $message;
45
46
        return $this;
47
    }
48
49
    /**
50
     * Get the post message.
51
     */
52
    public function getMessage(): ?string
53 6
    {
54
        return $this->message;
55 6
    }
56 6
57
    /**
58
     * Set ths post link.
59
     */
60
    public function withLink(?string $link)
61
    {
62
        $this->link = $link;
63 6
64
        return $this;
65 6
    }
66
67
    /**
68
     * Get the post link.
69
     */
70
    public function getLink(): ?string
71
    {
72
        return $this->link;
73
    }
74
75 1
    /**
76
     * Set the post params.
77 1
     */
78
    public function withParams(array $params)
79 1
    {
80
        $this->params = $params;
81
82
        return $this;
83
    }
84
85
    /**
86
     * Get the post params.
87
     */
88
    public function getParams(): array
89 1
    {
90
        return $this->params;
91 1
    }
92 1
93
    /**
94 1
     * Get the filtered body.
95
     */
96
    public function getBody(): array
97
    {
98
        $body = array_merge([
99
            'message' => $this->message,
100
            'link' => $this->link,
101
        ], $this->params);
102
103
        return array_filter($body);
104
    }
105
}
106