Completed
Push — master ( 4d781a...43cca9 )
by jelmer
02:32
created

Field::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 6
ccs 5
cts 5
cp 1
rs 9.4285
cc 1
eloc 4
nc 1
nop 3
crap 1
1
<?php
2
3
namespace Pageon\SlackWebhookMonolog\Slack\Attachment;
4
5
use JsonSerializable;
6
7
/**
8
 * @author Jelmer Prins <[email protected]>
9
 *
10
 * @since 0.3.2
11
 */
12
final class Field implements JsonSerializable
13
{
14
    /**
15
     * @var string
16
     */
17
    private $title;
18
19
    /**
20
     * @var string
21
     */
22
    private $value;
23
24
    /**
25
     * @var bool
26
     */
27
    private $short;
28
29
    /**
30
     * AttachmentField constructor.
31
     *
32
     * @param string $title
33
     * @param string $value
34
     * @param bool $short
35
     */
36 1
    public function __construct($title, $value, $short = false)
37
    {
38 1
        $this->title = $title;
39 1
        $this->value = $value;
40 1
        $this->short = $short;
41 1
    }
42
43
    /**
44
     * {@inheritdoc}
45
     */
46 1
    public function jsonSerialize()
47
    {
48
        return [
49 1
            'title' => $this->title,
50 1
            'value' => $this->value,
51 1
            'short' => $this->short,
52 1
        ];
53
    }
54
}
55