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

AbstractAction::__construct()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 4
dl 0
loc 7
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Neimheadh\SonataAnnotationBundle\Annotation;
6
7
use ReflectionException;
8
9
/**
10
 * Action annotations main class.
11
 *
12
 * @author Marko Kunic <[email protected]>
13
 * @author Mathieu Wambre <[email protected]>
14
 */
15
abstract class AbstractAction extends AbstractAnnotation
16
{
17
18
    /**
19
     * Action template.
20
     *
21
     * @var string|null
22
     */
23
    public ?string $template = null;
24
25
    /**
26
     * @param string|array|null $template Action template or annotation
27
     *                                    parameters.
28
     *
29
     * @throws ReflectionException
30
     */
31
    public function __construct(
32
        $template = null
33
    ) {
34
        if (is_array($template)) {
35
            $this->initAnnotation($template);
36
        } else {
37
            $this->template = $template;
38
        }
39
    }
40
41
}
42