ContainsKeyword::__construct()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 2
eloc 4
c 1
b 0
f 0
nc 2
nop 1
dl 0
loc 9
ccs 5
cts 5
cp 1
crap 2
rs 10
1
<?php
2
3
declare(strict_types=1);
4
5
namespace JsonSchema\Keyword;
6
7
use JsonSchema\Schema\SchemaInterface;
8
9
class ContainsKeyword extends AbstractKeyword
10
{
11
    const NAME = 'contains';
12
13 1
    public function __construct(?SchemaInterface $contains)
14
    {
15 1
        if (null === $contains) {
16 1
            parent::__construct(static::NAME, null);
17
18 1
            return;
19
        }
20
21 1
        parent::__construct(static::NAME, $contains->toJsonSchema());
22 1
    }
23
}
24