Completed
Push — master ( 759e75...59dba5 )
by Shane
02:24
created

ParserState   A

Complexity

Total Complexity 6

Size/Duplication

Total Lines 78
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 78
wmc 6
lcom 1
cbo 0
rs 10

6 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A isParsingString() 0 4 1
A isParsingKey() 0 4 1
A getBraceCount() 0 4 1
A getCharacters() 0 4 1
A getHeadCharacter() 0 4 1
1
<?php
2
3
namespace PhpHocon\Token\Parser;
4
5
use PhpHocon\Token\Value\ObjectValue;
6
7
class ParserState
8
{
9
    /**
10
     * @var string[]
11
     */
12
    private $characters;
13
14
    /**
15
     * @var int
16
     */
17
    private $braceCount;
18
    /**
19
     * @var bool
20
     */
21
    private $parsingString;
22
    /**
23
     * @var bool
24
     */
25
    private $parsingKey;
26
27
    /**
28
     * @param string[] $characters
29
     * @param int $braceCount
30
     * @param bool $parsingString
31
     * @param bool $parsingKey
32
     */
33
    public function __construct(
34
        array $characters,
35
        $braceCount,
36
        $parsingString = false,
37
        $parsingKey = false
38
    ) {
39
        $this->characters = $characters;
40
        $this->braceCount = $braceCount;
41
        $this->parsingString = $parsingString;
42
        $this->parsingKey = $parsingKey;
43
    }
44
45
    /**
46
     * @return boolean
47
     */
48
    public function isParsingString()
49
    {
50
        return $this->parsingString;
51
    }
52
53
    /**
54
     * @return boolean
55
     */
56
    public function isParsingKey()
57
    {
58
        return $this->parsingKey;
59
    }
60
61
    /**
62
     * @return int
63
     */
64
    public function getBraceCount()
65
    {
66
        return $this->braceCount;
67
    }
68
69
    /**
70
     * @return string[]
71
     */
72
    public function getCharacters()
73
    {
74
        return $this->characters;
75
    }
76
77
    /**
78
     * @return string
79
     */
80
    public function getHeadCharacter()
81
    {
82
        return $this->characters[0];
83
    }
84
}
85