ExamplesKeyword::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 6
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 5
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 11
ccs 6
cts 6
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JsonSchema\Keyword;
6
7
use Webmozart\Assert\Assert;
8
9
class ExamplesKeyword extends AbstractKeyword
10
{
11
    const NAME = 'examples';
12
13
    /**
14
     * @param array<mixed[]|bool|float|int|object|string|null>|null $examples
15
     */
16 8
    public function __construct(?array $examples)
17
    {
18 8
        if (null === $examples) {
0 ignored issues
show
introduced by
The condition null === $examples is always false.
Loading history...
19 8
            parent::__construct(static::NAME, null);
20
21 8
            return;
22
        }
23
24 8
        Assert::isNonEmptyList($examples);
25
26 8
        parent::__construct(static::NAME, $examples);
27 8
    }
28
}
29