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

ListAction   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 10 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
 * List action annotation.
13
 *
14
 * Allows you to configure your list page actions.
15
 *
16
 * @Annotation
17
 * @Target("CLASS")
18
 *
19
 * @author Marko Kunic <[email protected]>
20
 * @author Mathieu Wambre <[email protected]>
21
 */
22
#[Attribute(Attribute::TARGET_CLASS)]
23
final class ListAction extends AbstractAnnotation
24
{
25
26
    /**
27
     * Action name.
28
     *
29
     * @var string|null
30
     */
31
    public ?string $name = null;
32
33
    /**
34
     * Action options.
35
     *
36
     * @var array
37
     */
38
    public array $options = [];
39
40
    /**
41
     * @param string|array|null $name    Action name or annotation parameters.
42
     * @param array             $options Action options.
43
     *
44
     * @throws ReflectionException
45
     */
46
    public function __construct(
47
        $name = null,
48
        array $options = []
49
    ) {
50
        $this->options = $options;
51
52
        if (is_array($name)) {
53
            $this->initAnnotation($name);
54
        } else {
55
            $this->name = $name;
56
        }
57
    }
58
59
}
60