Histogram   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 18
rs 10
c 0
b 0
f 0
wmc 3

1 Method

Rating   Name   Duplication   Size   Complexity  
A trkHistogram() 0 12 3
1
<?php
2
/**
3
 * Trunking of "histogram"
4
 * User: moyo
5
 * Date: 2018/5/19
6
 * Time: 1:03 PM
7
 */
8
9
namespace Carno\Monitor\Chips\Trunks;
10
11
trait Histogram
12
{
13
    /**
14
     * @param array $input
15
     * @param array $output
16
     */
17
    protected function trkHistogram(array $input, array &$output) : void
18
    {
19
        if (empty($output)) {
20
            $output = $input;
21
            return;
22
        }
23
24
        $output['count'] += $input['count'];
25
        $output['sum'] += $input['sum'];
26
27
        foreach ($input['buckets'] as $idx => $bucket) {
28
            $output['buckets'][$idx][1] += $bucket[1];
29
        }
30
    }
31
}
32