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

Machine::type()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
ccs 2
cts 2
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 Machine implements \JsonSerializable
8
{
9
    /**
10
     * Cloud instance/machine type
11
     *
12
     * @var string
13
     */
14
    private $type;
15
16
    /**
17
     * @param string $type
18
     */
19 2
    public function __construct($type)
20
    {
21 2
        $this->type = $type;
22 2
    }
23
24
    /**
25
     * @return string
26
     */
27 1
    public function type()
28
    {
29 1
        return $this->type;
30
    }
31
32
    /**
33
     * @return array
34
     */
35 1
    public function jsonSerialize()
36
    {
37
        return [
38 1
            'type' => Encoding::keywordField($this->type),
39 1
        ];
40
    }
41
}
42