AttachmentField   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 55
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 5
eloc 14
c 0
b 0
f 0
dl 0
loc 55
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 6 1
A __construct() 0 5 1
A getTitle() 0 3 1
A isShort() 0 3 1
A getValue() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the Nexylan packages.
7
 *
8
 * (c) Nexylan SAS <[email protected]>
9
 *
10
 * For the full copyright and license information, please view the LICENSE
11
 * file that was distributed with this source code.
12
 */
13
14
namespace Nexy\Slack;
15
16
/**
17
 * @author Sullivan Senechal <[email protected]>
18
 */
19
final class AttachmentField
20
{
21
    /**
22
     * The required title field of the field.
23
     *
24
     * @var string
25
     */
26
    private $title;
27
28
    /**
29
     * The required value of the field.
30
     *
31
     * @var string
32
     */
33
    private $value;
34
35
    /**
36
     * Whether the value is short enough to fit side by side with
37
     * other values.
38
     *
39
     * @var bool
40
     */
41
    private $short;
42
43
    public function __construct(string $title, string $value, bool $short = false)
44
    {
45
        $this->title = $title;
46
        $this->value = $value;
47
        $this->short = $short;
48
    }
49
50
    public function getTitle(): string
51
    {
52
        return $this->title;
53
    }
54
55
    public function getValue(): string
56
    {
57
        return $this->value;
58
    }
59
60
    public function isShort(): bool
61
    {
62
        return $this->short;
63
    }
64
65
    /**
66
     * Get the array representation of this attachment field.
67
     */
68
    public function toArray(): array
69
    {
70
        return [
71
            'title' => $this->title,
72
            'value' => $this->value,
73
            'short' => $this->short,
74
        ];
75
    }
76
}
77