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 ( d55492...5a1c56 )
by Freek
02:41
created

AttachmentField::setTitle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
namespace Spatie\SlashCommand;
4
5
class AttachmentField
6
{
7
    /**
8
     * The required title field of the field.
9
     *
10
     * @var string
11
     */
12
    protected $title;
13
14
    /**
15
     * The required value of the field.
16
     *
17
     * @var string
18
     */
19
    protected $value;
20
21
    /**
22
     * Whether the value is short enough to fit side by side with
23
     * other values.
24
     *
25
     * @var bool
26
     */
27
    protected $short = false;
28
29
    public static function create(array $attributes)
30
    {
31
        return new static($attributes);
32
    }
33
34
    /**
35
     * @param array $attributes
36
     */
37
    public function __construct(array $attributes)
38
    {
39
        if (isset($attributes['title'])) {
40
            $this->setTitle($attributes['title']);
41
        }
42
43
        if (isset($attributes['value'])) {
44
            $this->setValue($attributes['value']);
45
        }
46
47
        if (isset($attributes['short'])) {
48
            $this->setShort($attributes['short']);
0 ignored issues
show
Bug introduced by
The method setShort() does not seem to exist on object<Spatie\SlashCommand\AttachmentField>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
49
        }
50
    }
51
52
    /**
53
     * Set the title of the field.
54
     *
55
     * @param string $title
56
     *
57
     * @return $this
58
     */
59
    public function setTitle(string $title)
60
    {
61
        $this->title = $title;
62
63
        return $this;
64
    }
65
66
    /**
67
     * Set the value of the field.
68
     *
69
     * @param string $value
70
     *
71
     * @return $this
72
     */
73
    public function setValue(string $value)
74
    {
75
        $this->value = $value;
76
77
        return $this;
78
    }
79
80
    public function displaySideBySide()
81
    {
82
        $this->short = true;
83
84
        return $this;
85
    }
86
87
    public function doNotDisplaySideBySide()
88
    {
89
        $this->short = false;
90
91
        return $this;
92
    }
93
94
    /**
95
     * Get the array representation of this attachment field.
96
     *
97
     * @return array
98
     */
99
    public function toArray(): array
100
    {
101
        return [
102
            'title' => $this->title,
103
            'value' => $this->value,
104
            'short' => $this->short,
105
        ];
106
    }
107
}
108