Passed
Push — develop ( 5825a6...894992 )
by Mathieu
02:22
created

ShowAssociationField   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 6
c 0
b 0
f 0
dl 0
loc 29
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Neimheadh\SonataAnnotationBundle\Annotation\Sonata;
6
7
use Attribute;
8
use Neimheadh\SonataAnnotationBundle\Annotation\AssociationFieldInterface;
9
10
/**
11
 * Show association field annotation.
12
 *
13
 * Allows you to configure your show field having an association field.
14
 *
15
 * @Annotation
16
 * @Target({"PROPERTY"})
17
 *
18
 * @author Marko Kunic <[email protected]>
19
 * @author Mathieu Wambre <[email protected]>
20
 */
21
#[Attribute(Attribute::TARGET_PROPERTY)]
22
final class ShowAssociationField extends ShowField implements
23
    AssociationFieldInterface
24
{
25
26
    /**
27
     * Association field name.
28
     *
29
     * @var string|null
30
     */
31
    public ?string $field = null;
32
33
    /**
34
     * @param string|array|null $type                    Type or annotation
35
     *                                                   parameters.
36
     * @param array             $fieldDescriptionOptions Description options.
37
     * @param int|null          $position                Position.
38
     * @param string|null       $field                   Association field name.
39
     *
40
     * @throws \ReflectionException
41
     */
42
    public function __construct(
43
        $type = null,
44
        array $fieldDescriptionOptions = [],
45
        ?int $position = null,
46
        ?string $field = null
47
    ) {
48
        $this->field = $field;
49
        parent::__construct($type, $fieldDescriptionOptions, $position);
50
    }
51
52
}
53