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

ExportField   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 7
dl 0
loc 23
rs 10
c 1
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 7 2
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