MemoryProcessor   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 1
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A updateContext() 0 6 1
1
<?php
2
3
/**
4
 * Phoole (PHP7.2+)
5
 *
6
 * @category  Library
7
 * @package   Phoole\Logger
8
 * @copyright Copyright (c) 2019 Hong Zhang
9
 */
10
declare(strict_types=1);
11
12
namespace Phoole\Logger\Processor;
13
14
/**
15
 * Add system memory usage to log entry's context
16
 *
17
 * @package Phoole\Logger
18
 */
19
class MemoryProcessor extends ProcessorAbstract
20
{
21
    /**
22
     * {@inheritDoc}
23
     */
24
    protected function updateContext(array $context): array
25
    {
26
        $context['memory_used'] = number_format(memory_get_usage(TRUE) / 1048575, 2);
27
        $context['memory_peak'] = number_format(memory_get_peak_usage(TRUE) / 1048575, 2);
28
        return $context;
29
    }
30
}