CollectorException::duplicatedKey()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 2
dl 0
loc 5
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
declare(strict_types=1);
3
4
namespace JsonDecodeStream\Exception;
5
6
use JsonDecodeStream\Event;
7
8
class CollectorException extends JsonDecodeStreamException
9
{
10
    const CODE_DUPLICATE_KEY = 1;
11
12
    public static function duplicatedKey(string $key, Event $event)
13
    {
14
        return new static(
15
            "Key `$key` is duplicated in {$event->getPath()} at {$event->getLineNumber()}:{$event->getCharNumber()}",
16
            static::CODE_DUPLICATE_KEY
17
        );
18
    }
19
}
20