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.
Completed
Push — master ( c6d03b...e8435c )
by Ema
02:43
created

PostBuilder   A

Complexity

Total Complexity 7

Size/Duplication

Total Lines 81
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 1
dl 0
loc 81
ccs 19
cts 19
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A setMessage() 0 6 1
A setChannelId() 0 6 1
A setRootId() 0 6 1
A setFileIds() 0 6 1
A setIsPinned() 0 6 1
A getRequiredFields() 0 9 2
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
    /**
12
     * @param $message
13
     *
14
     * @return $this
15
     */
16 2
    public function setMessage($message)
17
    {
18 2
        $this->params['message'] = $message;
19
20 2
        return $this;
21
    }
22
23
    /**
24
     * @param $channelId
25
     *
26
     * @return $this
27
     */
28 2
    public function setChannelId($channelId)
29
    {
30 2
        $this->params['channel_id'] = $channelId;
31
32 2
        return $this;
33
    }
34
35
    /**
36
     * Set the post ID to comment on.
37
     *
38
     * @param $postId
39
     *
40
     * @return $this
41
     */
42 1
    public function setRootId(string $postId)
43
    {
44 1
        $this->params['root_id'] = $postId;
45
46 1
        return $this;
47
    }
48
49
    /**
50
     * A list of file IDs to associate with the post.
51
     *
52
     * @param $fileIds
53
     *
54
     * @return $this
55
     */
56 1
    public function setFileIds(array $fileIds)
57
    {
58 1
        $this->params['file_ids'] = $fileIds;
59
60 1
        return $this;
61
    }
62
63
    /**
64
     * Set if the post is pinned.
65
     *
66
     * @param bool $isPinned
67
     *
68
     * @return $this
69
     */
70 1
    public function setIsPinned(bool $isPinned)
71
    {
72 1
        $this->params['is_pinned'] = $isPinned;
73
74 1
        return $this;
75
    }
76
77
    /**
78
     * {@inheritdoc}
79
     */
80 5
    protected function getRequiredFields($buildType = self::BUILD_FOR_CREATE)
81
    {
82
        switch ($buildType) {
83 5
            case self::BUILD_FOR_CREATE:
84 3
                return ['channel_id', 'message'];
85
            default:
86 2
                return [];
87
        }
88
    }
89
}
90