PhpVersion   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 35
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 88.89%

Importance

Changes 5
Bugs 1 Features 1
Metric Value
wmc 4
c 5
b 1
f 1
lcom 1
cbo 1
dl 0
loc 35
ccs 8
cts 9
cp 0.8889
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A resolve() 0 4 1
A validate() 0 6 2
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
use Ndrx\Profiler\Renderer\BarRenderableInterface;
14
15
class PhpVersion extends Collector implements StartCollectorInterface, BarRenderableInterface
16
{
17
    /**
18
     * Fetch data
19
     * @return mixed
20
     */
21 12
    public function resolve()
22
    {
23 12
        $this->data = phpversion();
24 12
    }
25
26 10
    public function validate()
27
    {
28 10
        if (!is_string($this->data)) {
29
            throw new \LogicException('Duration must be a string ' . json_encode($this->data) . ' given');
30
        }
31 10
    }
32
33
    /**
34
     * The path in the final json
35
     * @example
36
     *  path /aa/bb
37
     *  will be transformed to
38
     *  {
39
     *     aa : {
40
     *              bb: <VALUE OF RESOLVE>
41
     *       }
42
     *  }
43
     * @return string
44
     */
45 110
    public function getPath()
46
    {
47 110
        return 'php-version';
48
    }
49
}
50