StringAnalyser   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 38
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 100%

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 5 1
A parse() 0 4 1
A createAnalysisTargetId() 0 4 1
1
<?php
2
/**
3
 * StringAnalyser.php
4
 *
5
 * MIT LICENSE
6
 *
7
 * LICENSE: This source file is subject to the MIT license.
8
 * A copy of the licenses text was distributed alongside this
9
 * file (usually the repository or package root). The text can also
10
 * be obtained through one of the following sources:
11
 * * http://opensource.org/licenses/MIT
12
 * * https://github.com/suralc/pvra/blob/master/LICENSE
13
 *
14
 * @author     suralc <[email protected]>
15
 * @license    http://opensource.org/licenses/MIT  MIT
16
 */
17
namespace Pvra;
18
19
/**
20
 * Class StringAnalyser
21
 *
22
 * @package Pvra
23
 */
24
class StringAnalyser extends Analyser
25
{
26
    /**
27
     * The string to analyse
28
     *
29
     * @var string
30
     */
31
    private $string;
32
33
    /**
34
     * StringAnalyser constructor
35
     *
36
     * @param string $string The code to analyse
37
     * @param bool $registerNameResolver Inherited from the base class `Analyser`
38
     * @see Analyser::__construct() Base Constructor
39
     */
40 38
    public function __construct($string, $registerNameResolver = true)
41
    {
42 38
        $this->string = $string;
43 38
        parent::__construct($registerNameResolver);
44 38
    }
45
46
    /**
47
     * @inheritdoc
48
     */
49 2
    protected function parse()
50
    {
51 2
        return $this->getParser()->parse($this->string);
52
    }
53
54
    /**
55
     * @inheritdoc
56
     */
57 26
    protected function createAnalysisTargetId()
58
    {
59 26
        return '<string>';
60
    }
61
}
62