Field   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 52
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 2
Metric Value
wmc 2
c 2
b 0
f 2
lcom 1
cbo 0
dl 0
loc 52
ccs 10
cts 10
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 6 1
A jsonSerialize() 0 8 1
1
<?php
2
3
namespace Pageon\SlackWebhookMonolog\Slack\Attachment;
4
5
use JsonSerializable;
6
7
/**
8
 * Will be displayed in a table inside the message attachment.
9
 *
10
 * @author Jelmer Prins <[email protected]>
11
 *
12
 * @since 0.4.0
13
 */
14
final class Field implements JsonSerializable
15
{
16
    /**
17
     * Shown as a bold heading above the value text.
18
     * It cannot contain markup and will be escaped for you.
19
     *
20
     * @var string
21
     */
22
    private $title;
23
24
    /**
25
     * The text value of the field.
26
     * It may contain standard message markup and must be escaped as normal.
27
     * May be multi-line.
28
     *
29
     * @var string
30
     */
31
    private $value;
32
33
    /**
34
     * An optional flag indicating whether the value is short enough to be displayed side-by-side with other values.
35
     *
36
     * @var bool
37
     */
38
    private $short;
39
40
    /**
41
     * AttachmentField constructor.
42
     *
43
     * @param string $title
44
     * @param string $value
45
     * @param bool $short
46
     */
47 13
    public function __construct($title, $value, $short = false)
48
    {
49 13
        $this->title = $title;
50 13
        $this->value = $value;
51 13
        $this->short = $short;
52 13
    }
53
54
    /**
55
     * {@inheritdoc}
56
     */
57 13
    public function jsonSerialize()
58
    {
59
        return [
60 13
            'title' => $this->title,
61 13
            'value' => $this->value,
62 13
            'short' => $this->short,
63 13
        ];
64
    }
65
}
66