Events   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
lcom 1
cbo 2
dl 0
loc 41
c 0
b 0
f 0
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A addRow() 0 7 1
A prepare() 0 6 1
1
<?php
2
3
namespace Spiral\Statistics\Extract;
4
5
use Spiral\Statistics\Extract\Events\Row;
6
7
class Events
8
{
9
    /** @var array */
10
    protected $events = [];
11
12
    /** @var array */
13
    protected $rows = [];
14
15
    /**
16
     * Results constructor.
17
     *
18
     * @param array $events
19
     */
20
    public function __construct(array $events)
21
    {
22
        $this->events = $events;
23
    }
24
25
    /**
26
     * @param string $label
27
     * @return Row
28
     */
29
    public function addRow(string $label): Row
30
    {
31
        $row = new Row($label, $this->events);
32
        $this->rows[$label] = $row;
33
34
        return $row;
35
    }
36
37
    /**
38
     * @param DatasetInterface $dataset
39
     * @return DatasetInterface
40
     */
41
    public function prepare(DatasetInterface $dataset): DatasetInterface
42
    {
43
        $dataset->setData($this->rows);
44
45
        return $dataset;
46
    }
47
}