Context   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 42
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 11 1
A getDataFields() 0 6 1
A getPath() 0 4 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arnaud
5
 * Date: 01/11/15
6
 * Time: 20:43
7
 */
8
9
namespace Ndrx\Profiler\Collectors\Data;
10
11
use Ndrx\Profiler\Collectors\Collector;
12
use Ndrx\Profiler\Collectors\Contracts\StartCollectorInterface;
13
14
class Context extends Collector implements StartCollectorInterface
15
{
16
    /**
17
     * Fetch data
18
     * @return mixed
19
     */
20 4
    public function resolve()
21
    {
22 4
        $this->data = [
23 4
            'environment' => php_sapi_name(),
24 4
            'process-id' => $this->process->getId(),
25 4
            'parent-process-id' => $this->process->getParentId(),
26 4
            'date' => date('Y-m-d'),
27 4
            'time' => date('H:m:s'),
28 4
            'timestamp' => time()
29 4
        ];
30 4
    }
31
32 6
    public function getDataFields()
33
    {
34
        return [
35 6
            'environment', 'date', 'time', 'timestamp', 'process-id', 'parent-process-id'
36 6
        ];
37
    }
38
39
    /**
40
     * The path in the final json
41
     * @example
42
     *  path /aa/bb
43
     *  will be transformed to
44
     *  {
45
     *     aa : {
46
     *              bb: <VALUE OF RESOLVE>
47
     *       }
48
     *  }
49
     * @return mixed
50
     */
51 2
    public function getPath()
52
    {
53 2
        return 'context';
54
    }
55
}
56