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.

PostBuilder::setIsPinned()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Pnz\MattermostClient\Model\Post;
6
7
use Pnz\MattermostClient\Model\ModelBuilder;
8
9
class PostBuilder extends ModelBuilder
10
{
11 2
    public function setMessage(string $message): self
12
    {
13 2
        $this->params['message'] = $message;
14
15 2
        return $this;
16
    }
17
18 2
    public function setChannelId(string $channelId): self
19
    {
20 2
        $this->params['channel_id'] = $channelId;
21
22 2
        return $this;
23
    }
24
25
    /**
26
     * Set the post ID to comment on.
27
     */
28 1
    public function setRootId(string $postId): self
29
    {
30 1
        $this->params['root_id'] = $postId;
31
32 1
        return $this;
33
    }
34
35
    /**
36
     * A list of file IDs to associate with the post.
37
     *
38
     * @param string[] $fileIds
39
     */
40 1
    public function setFileIds(array $fileIds): self
41
    {
42 1
        $this->params['file_ids'] = $fileIds;
43
44 1
        return $this;
45
    }
46
47
    /**
48
     * Set if the post is pinned.
49
     */
50 1
    public function setIsPinned(bool $isPinned): self
51
    {
52 1
        $this->params['is_pinned'] = $isPinned;
53
54 1
        return $this;
55
    }
56
57 5
    protected function getRequiredFields(string $buildType = self::BUILD_FOR_CREATE): array
58
    {
59
        switch ($buildType) {
60 5
            case self::BUILD_FOR_CREATE:
61 3
                return ['channel_id', 'message'];
62
            default:
63 2
                return [];
64
        }
65
    }
66
}
67