SingleTable::getChildren()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 1
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
ccs 1
cts 1
cp 1
crap 1
rs 10
c 1
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cycle\Schema\Definition\Inheritance;
6
7
use Cycle\Schema\Definition\Inheritance;
8
9
final class SingleTable extends Inheritance
10
{
11
    /** @var array<non-empty-string, class-string> */
0 ignored issues
show
Documentation Bug introduced by
The doc comment array<non-empty-string, class-string> at position 2 could not be parsed: Unknown type name 'non-empty-string' at position 2 in array<non-empty-string, class-string>.
Loading history...
12
    private array $children = [];
13
14
    private ?string $discriminator = null;
15
16
    /**
17
     * @param non-empty-string $discriminatorValue
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string.
Loading history...
18
     * @param class-string $class
19 4
     */
20
    public function addChild(string $discriminatorValue, string $class): void
21 4
    {
22 4
        $this->children[$discriminatorValue] = $class;
23
    }
24 4
25
    public function getChildren(): array
26 4
    {
27
        return $this->children;
28
    }
29 8
30
    public function getDiscriminator(): ?string
31 8
    {
32
        return $this->discriminator;
33
    }
34
35
    /**
36
     * @param non-empty-string|null $discriminator
0 ignored issues
show
Documentation Bug introduced by
The doc comment non-empty-string|null at position 0 could not be parsed: Unknown type name 'non-empty-string' at position 0 in non-empty-string|null.
Loading history...
37 6
     */
38
    public function setDiscriminator(?string $discriminator): void
39 6
    {
40 6
        $this->discriminator = $discriminator;
41
    }
42
}
43