PhpVersion::getPath()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 0
crap 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