Failed Conditions
Push — master ( becf73...b9880b )
by Guilherme
09:53
created

LocalColumnMetadata::getValueGenerationExecutor()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 4
CRAP Score 2

Importance

Changes 0
Metric Value
cc 2
eloc 3
nc 2
nop 1
dl 0
loc 5
ccs 4
cts 4
cp 1
crap 2
rs 10
c 0
b 0
f 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Mapping;
6
7
use Doctrine\DBAL\Platforms\AbstractPlatform;
8
use Doctrine\ORM\Sequencing\Planning\ColumnValueGeneratorExecutor;
9
use Doctrine\ORM\Sequencing\Planning\ValueGenerationExecutor;
10
11
abstract class LocalColumnMetadata extends ColumnMetadata
12
{
13
    /** @var int|null */
14
    protected $length;
15
16
    /** @var int|null */
17
    protected $scale;
18
19
    /** @var int|null */
20
    protected $precision;
21
22
    /** @var ValueGeneratorMetadata|null */
23
    protected $valueGenerator;
24
25 274
    public function getLength() : ?int
26
    {
27 274
        return $this->length;
28
    }
29
30 387
    public function setLength(int $length) : void
31
    {
32 387
        $this->length = $length;
33 387
    }
34
35 266
    public function getScale() : ?int
36
    {
37 266
        return $this->scale;
38
    }
39
40 369
    public function setScale(int $scale) : void
41
    {
42 369
        $this->scale = $scale;
43 369
    }
44
45 266
    public function getPrecision() : ?int
46
    {
47 266
        return $this->precision;
48
    }
49
50 369
    public function setPrecision(int $precision) : void
51
    {
52 369
        $this->precision = $precision;
53 369
    }
54
55 1245
    public function hasValueGenerator() : bool
56
    {
57 1245
        return $this->valueGenerator !== null;
58
    }
59
60 1107
    public function getValueGenerator() : ?ValueGeneratorMetadata
61
    {
62 1107
        return $this->valueGenerator;
63
    }
64
65 318
    public function setValueGenerator(ValueGeneratorMetadata $valueGenerator) : void
66
    {
67 318
        $valueGenerator->setDeclaringProperty($this);
0 ignored issues
show
Bug introduced by
$this of type Doctrine\ORM\Mapping\LocalColumnMetadata is incompatible with the type Doctrine\ORM\Mapping\Property expected by parameter $declaringProperty of Doctrine\ORM\Mapping\Val...:setDeclaringProperty(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

67
        $valueGenerator->setDeclaringProperty(/** @scrutinizer ignore-type */ $this);
Loading history...
68
69 318
        $this->valueGenerator = $valueGenerator;
70 318
    }
71
72 367
    public function getValueGenerationExecutor(AbstractPlatform $platform) : ?ValueGenerationExecutor
73
    {
74 367
        return $this->hasValueGenerator()
75 294
            ? new ColumnValueGeneratorExecutor($this, $this->valueGenerator->getSequencingGenerator($platform))
76 367
            : null;
77
    }
78
}
79