Passed
Pull Request — 5.1 (#187)
by
unknown
02:34
created

ScalarReferencePropertyDescriptor   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 2
Bugs 0 Features 0
Metric Value
wmc 3
eloc 6
c 2
b 0
f 0
dl 0
loc 28
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 1
A getReferencedPropertyDescriptor() 0 3 1
A getJsonSerializeCode() 0 3 1
1
<?php
2
3
4
namespace TheCodingMachine\TDBM\Utils;
5
6
use Doctrine\DBAL\Schema\Column;
7
use Doctrine\DBAL\Schema\Table;
8
use TheCodingMachine\TDBM\Utils\Annotation\AnnotationParser;
9
10
/**
11
 * This class represents a reference to a AbstractBeanPropertyDescriptor
12
 */
13
class ScalarReferencePropertyDescriptor extends ScalarBeanPropertyDescriptor
14
{
15
    /** @var AbstractBeanPropertyDescriptor */
16
    private $referencedPropertyDescriptor;
17
18
    public function __construct(
19
        Table $table,
20
        Column $column,
21
        NamingStrategyInterface $namingStrategy,
22
        AnnotationParser $annotationParser,
23
        AbstractBeanPropertyDescriptor $referencedPropertyDescriptor
24
    )
25
    {
26
        parent::__construct($table, $column, $namingStrategy, $annotationParser);
27
        $this->referencedPropertyDescriptor = $referencedPropertyDescriptor;
28
    }
29
30
    /**
31
     * @return AbstractBeanPropertyDescriptor
32
     */
33
    public function getReferencedPropertyDescriptor(): AbstractBeanPropertyDescriptor
34
    {
35
        return $this->referencedPropertyDescriptor;
36
    }
37
38
    public function getJsonSerializeCode(): string
39
    {
40
        return $this->referencedPropertyDescriptor->getJsonSerializeCode();
41
    }
42
}
43