Passed
Push — master ( bef5d8...6aa175 )
by Zoilo
03:10 queued 28s
created

Project::jsonSerialize()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 1
rs 10
1
<?php
2
3
namespace ZoiloMora\ElasticAPM\Events\Common\Cloud;
4
5
use ZoiloMora\ElasticAPM\Helper\Encoding;
6
7
final class Project implements \JsonSerializable
8
{
9
    /**
10
     * Cloud project ID
11
     *
12
     * @var string
13
     */
14
    private $id;
15
16
    /**
17
     * Cloud project name
18
     *
19
     * @var string
20
     */
21
    private $name;
22
23
    /**
24
     * @param string $id
25
     * @param string $name
26
     */
27 2
    public function __construct($id, $name)
28
    {
29 2
        $this->id = $id;
30 2
        $this->name = $name;
31 2
    }
32
33
    /**
34
     * @return string
35
     */
36 1
    public function id()
37
    {
38 1
        return $this->id;
39
    }
40
41
    /**
42
     * @return string
43
     */
44 1
    public function name()
45
    {
46 1
        return $this->name;
47
    }
48
49
    /**
50
     * @return array
51
     */
52 1
    public function jsonSerialize()
53
    {
54
        return [
55 1
            'id' => Encoding::keywordField($this->id),
56 1
            'name' => Encoding::keywordField($this->name),
57 1
        ];
58
    }
59
}
60