StreamCollector   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Test Coverage

Coverage 100%

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 1
c 2
b 0
f 0
lcom 0
cbo 3
dl 0
loc 19
ccs 6
cts 6
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 9 1
registerListeners() 0 1 ?
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arnaud
5
 * Date: 31/10/15
6
 * Time: 17:40
7
 */
8
9
namespace Ndrx\Profiler\Collectors;
10
11
use Ndrx\Profiler\Collectors\Contracts\StreamCollectorInterface;
12
use Ndrx\Profiler\DataSources\Contracts\DataSourceInterface;
13
use Ndrx\Profiler\JsonPatch;
14
use Ndrx\Profiler\Process;
15
16
/**
17
 * Class StreamCollector
18
 * @package Ndrx\Profiler\Collectors
19
 */
20
abstract class StreamCollector extends Collector implements StreamCollectorInterface
21
{
22
    /**
23
     * @param Process $process
24
     * @param DataSourceInterface $dataSource
25
     * @param JsonPatch|null $jsonPatch
26
     */
27 118
    public function __construct(Process $process, DataSourceInterface $dataSource, JsonPatch $jsonPatch = null)
28
    {
29 118
        parent::__construct($process, $dataSource, $jsonPatch);
30
31
        // create logs domain
32 118
        $patch = $this->jsonPatch->generate($this->getPath(), JsonPatch::ACTION_ADD, [], false);
33 118
        $this->dataSource->save($this->process, [$patch]);
34 118
        $this->registerListeners();
35 118
    }
36
37
    abstract protected function registerListeners();
38
}
39