PhpCollector   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 10
c 3
b 0
f 0
dl 0
loc 28
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A collect() 0 13 1
A getIdentifier() 0 3 1
1
<?php
2
3
namespace Startwind\Inventorio\Collector\Application\ProgrammingLanguage;
4
5
use Startwind\Inventorio\Collector\Collector;
6
use Startwind\Inventorio\Exec\Runner;
7
8
class PhpCollector implements Collector
9
{
10
    protected const COLLECTION_IDENTIFIER = 'PHP';
11
12
    /**
13
     * @inheritDoc
14
     */
15
    public function getIdentifier(): string
16
    {
17
        return self::COLLECTION_IDENTIFIER;
18
    }
19
20
    /**
21
     * @inheritDoc
22
     */
23
    public function collect(): array
24
    {
25
        // exec('pgrep -a php-fpm', $output);
26
        Runner::outputToArray(Runner::getInstance()->run('pgrep -a php-fpm')->getOutput());
27
28
        $fpm = !empty($output);
0 ignored issues
show
Comprehensibility Best Practice introduced by
The variable $output seems to never exist and therefore empty should always be true.
Loading history...
29
30
        return [
31
            'versions' => [
32
                PHP_VERSION
33
            ],
34
            'modules' => get_loaded_extensions(),
35
            'fpm' => $fpm
36
        ];
37
    }
38
}
39