InventorioCollector::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nc 1
nop 5
dl 0
loc 7
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Startwind\Inventorio\Collector\Inventorio;
4
5
use Startwind\Inventorio\Collector\Collector;
6
use Startwind\Inventorio\Config\Config;
7
8
/**
9
 * This collector returns details about this Inventorio client
10
 */
11
class InventorioCollector implements Collector
12
{
13
    protected const COLLECTION_IDENTIFIER = '_Inventorio';
14
    private bool $isRemoteEnabled;
15
    private bool $areLogfileEnabled;
16
17
    private Config $config;
18
    private bool $areMetricsEnabled;
19
    private bool $isSmartCareEnabled;
20
21
    public function __construct(bool $isRemoteEnabled, bool $areLogfileEnabled, bool $areMetricsEnabled, bool $isSmartCareEnabled, Config $config)
22
    {
23
        $this->isRemoteEnabled = $isRemoteEnabled;
24
        $this->areLogfileEnabled = $areLogfileEnabled;
25
        $this->areMetricsEnabled = $areMetricsEnabled;
26
        $this->isSmartCareEnabled = $isSmartCareEnabled;
27
        $this->config = $config;
28
    }
29
30
    /**
31
     * @inheritDoc
32
     */
33
    public function getIdentifier(): string
34
    {
35
        return self::COLLECTION_IDENTIFIER;
36
    }
37
38
    /**
39
     * @inheritDoc
40
     */
41
    public function collect(): array
42
    {
43
        return [
44
            'client' => [
45
                'version' => INVENTORIO_VERSION,
46
                'isRemoteEnabled' => $this->isRemoteEnabled,
47
                'isSmartCareEnabled' => $this->isSmartCareEnabled,
48
                'areMetricsEnabled' => $this->areMetricsEnabled,
49
                'areLogfilesEnabled' => $this->areLogfileEnabled
50
            ],
51
            'logfiles' => $this->config->getLogfiles()
52
        ];
53
    }
54
}
55