Constant::mutateState()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 1
c 0
b 0
f 0
nc 2
nop 1
dl 0
loc 3
ccs 2
cts 2
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 constant token.
9
 *
10
 */
11
final class Constant extends Token
12
{
13
    /**
14
     * Mutate the given state
15
     *
16
     * @param State $state
17
     * @return void
18
     */
19 296
    public function mutateState(State $state): void
20
    {
21 296
        $state->expectedToken = $state->tree->inObject() ? Tokens::AFTER_OBJECT_VALUE : Tokens::AFTER_ARRAY_VALUE;
22
    }
23
24
    /**
25
     * Determine whether this token ends a JSON chunk
26
     *
27
     * @return bool
28
     */
29 296
    public function endsChunk(): bool
30
    {
31 296
        return true;
32
    }
33
}
34