LocalColumnMetadataExporter   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
eloc 13
dl 0
loc 27
ccs 0
cts 17
cp 0
rs 10
c 0
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A export() 0 22 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Doctrine\ORM\Mapping\Exporter;
6
7
use Doctrine\ORM\Mapping\LocalColumnMetadata;
8
use const PHP_EOL;
9
use function implode;
10
use function sprintf;
11
use function str_repeat;
12
use function var_export;
13
14
abstract class LocalColumnMetadataExporter extends ColumnMetadataExporter
15
{
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function export($value, int $indentationLevel = 0) : string
20
    {
21
        /** @var LocalColumnMetadata $value */
22
        $indentation     = str_repeat(self::INDENTATION, $indentationLevel);
23
        $objectReference = $indentation . self::VARIABLE;
24
        $lines           = [];
25
26
        $lines[] = parent::export($value, $indentationLevel);
27
28
        $lines[] = $objectReference . '->setLength(' . $value->getLength() . ');';
29
        $lines[] = $objectReference . '->setScale(' . $value->getScale() . ');';
30
        $lines[] = $objectReference . '->setPrecision(' . $value->getPrecision() . ');';
31
32
        if ($value->hasValueGenerator()) {
33
            $lines[] = sprintf(
34
                $objectReference . '->setValueGenerator(new ValueGenerator(%s, %s));',
35
                var_export($value->getValueGenerator()->getType(), true),
36
                var_export($value->getValueGenerator()->getDefinition(), true)
0 ignored issues
show
Bug introduced by
The method getDefinition() does not exist on Doctrine\ORM\Mapping\ValueGeneratorMetadata. ( Ignorable by Annotation )

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

36
                var_export($value->getValueGenerator()->/** @scrutinizer ignore-call */ getDefinition(), true)

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
            );
38
        }
39
40
        return implode(PHP_EOL, $lines);
41
    }
42
}
43