PhpCollector::getIdentifier()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
nc 1
nop 0
dl 0
loc 3
c 0
b 0
f 0
cc 1
rs 10
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