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.

AttachmentField   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 91
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 7
lcom 1
cbo 0
dl 0
loc 91
rs 10
c 0
b 0
f 0

7 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 4 1
A __construct() 0 5 1
A setTitle() 0 6 1
A setValue() 0 6 1
A displaySideBySide() 0 6 1
A doNotDisplaySideBySide() 0 6 1
A toArray() 0 8 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($title, $value)
30
    {
31
        return new static($title, $value);
32
    }
33
34
    public function __construct(string $title, string $value)
35
    {
36
        $this->title = $title;
37
        $this->value = $value;
38
    }
39
40
    /**
41
     * Set the title of the field.
42
     *
43
     * @param string $title
44
     *
45
     * @return $this
46
     */
47
    public function setTitle(string $title)
48
    {
49
        $this->title = $title;
50
51
        return $this;
52
    }
53
54
    /**
55
     * Set the value of the field.
56
     *
57
     * @param string $value
58
     *
59
     * @return $this
60
     */
61
    public function setValue(string $value)
62
    {
63
        $this->value = $value;
64
65
        return $this;
66
    }
67
68
    public function displaySideBySide()
69
    {
70
        $this->short = true;
71
72
        return $this;
73
    }
74
75
    public function doNotDisplaySideBySide()
76
    {
77
        $this->short = false;
78
79
        return $this;
80
    }
81
82
    /**
83
     * Get the array representation of this attachment field.
84
     *
85
     * @return array
86
     */
87
    public function toArray(): array
88
    {
89
        return [
90
            'title' => $this->title,
91
            'value' => $this->value,
92
            'short' => $this->short,
93
        ];
94
    }
95
}
96