CompoundEnd::mutateState()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 2
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 5
ccs 3
cts 3
cp 1
crap 2
rs 10
1
<?php
2
3
namespace Cerbero\JsonParser\Tokens;
4
5
use Cerbero\JsonParser\ValueObjects\State;
6
7
/**
8
 * The token that ends compound data (JSON arrays or objects).
9
 *
10
 */
11
final class CompoundEnd extends Token
12
{
13
    /**
14
     * Mutate the given state
15
     *
16
     * @param State $state
17
     * @return void
18
     */
19 266
    public function mutateState(State $state): void
20
    {
21 266
        $state->tree->emerge();
22
23 266
        $state->expectedToken = $state->tree->inObject() ? Tokens::AFTER_OBJECT_VALUE : Tokens::AFTER_ARRAY_VALUE;
24
    }
25
26
    /**
27
     * Determine whether this token ends a JSON chunk
28
     *
29
     * @return bool
30
     */
31 266
    public function endsChunk(): bool
32
    {
33 266
        return true;
34
    }
35
}
36