MetadataBuilder   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 12
dl 0
loc 28
c 0
b 0
f 0
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A buildService() 0 19 1
1
<?php
2
3
namespace SamuelBednarcik\ElasticAPMAgent\Builder;
4
5
use SamuelBednarcik\ElasticAPMAgent\Agent;
6
7
class MetadataBuilder extends AbstractEventBuilder
8
{
9
    /**
10
     * @param string $name
11
     * @param string|null $version
12
     * @param string|null $environment
13
     * @param string|null $framework
14
     * @return array
15
     */
16
    public static function buildService(
17
        string $name,
18
        string $version = null,
19
        string $environment = null,
20
        string $framework = null
21
    ): array {
22
        return [
23
            'agent' => [
24
                'name' => Agent::AGENT_NAME,
25
                'version' => Agent::AGENT_VERSION
26
            ],
27
            'framework' => $framework,
28
            'language' => [
29
                'name' => 'PHP',
30
                'version' => phpversion()
31
            ],
32
            'name' => $name,
33
            'environment' => $environment,
34
            'version' => $version,
35
        ];
36
    }
37
}
38