Passed
Push — develop ( 355f63...51016a )
by Mathieu
02:23
created

ExportField::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 1
b 0
f 0
cc 2
nc 2
nop 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\AbstractAnnotation;
9
use ReflectionException;
10
11
/**
12
 * Export field annotation.
13
 *
14
 * Allow you to configure the export for the annotated field.
15
 *
16
 * @Annotation
17
 * @Target({"PROPERTY", "METHOD"})
18
 *
19
 * @author Marko Kunic <[email protected]>
20
 * @author Mathieu Wambre <[email protected]>
21
 */
22
#[Attribute(Attribute::TARGET_METHOD | Attribute::TARGET_PROPERTY)]
23
class ExportField extends AbstractAnnotation
24
{
25
26
    /**
27
     * Export label.
28
     *
29
     * @var string|null
30
     */
31
    public ?string $label = null;
32
33
    /**
34
     * @param string|array|null $label Export label or annotation parameters.
35
     *
36
     * @throws ReflectionException
37
     */
38
    public function __construct(
39
        $label = null
40
    ) {
41
        if (is_array($label)) {
42
            $this->initAnnotation($label);
43
        } else {
44
            $this->label = $label;
45
        }
46
    }
47
48
}
49