Passed
Pull Request — master (#51)
by Shinji
32:54
created

ProcessStateCollector   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 8
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
eloc 4
c 1
b 0
f 1
dl 0
loc 8
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A collect() 0 6 1
1
<?php
2
3
/**
4
 * This file is part of the sj-i/php-profiler package.
5
 *
6
 * (c) sji <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace PhpProfiler\Lib\Log\StateCollector;
15
16
use function getmypid;
17
use function memory_get_peak_usage;
18
use function memory_get_usage;
19
20
final class ProcessStateCollector implements StateCollector
21
{
22
    public function collect(): array
23
    {
24
        return [
25
            'pid' => getmypid(),
26
            'memory_usage' => memory_get_usage(),
27
            'peak_memory_usage' => memory_get_peak_usage(),
28
        ];
29
    }
30
}
31