CompoundEnd   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
c 1
b 0
f 0
dl 0
loc 23
ccs 5
cts 5
cp 1
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A mutateState() 0 5 2
A endsChunk() 0 3 1
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