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

Field   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 43
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 0
dl 0
loc 43
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
 * @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