DatagridValuesReader::getDatagridValues()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 11
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 11
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\Reader;
6
7
use Neimheadh\SonataAnnotationBundle\Annotation\DatagridValues;
8
use ReflectionClass;
9
10
/**
11
 * DatagridValues annotation reader.
12
 *
13
 * @author Marko Kunic <[email protected]>
14
 * @author Mathieu Wambre <[email protected]>
15
 */
16
final class DatagridValuesReader extends AbstractReader
17
{
18
19
    /**
20
     * Get the list of datagrid values.
21
     *
22
     * @param ReflectionClass $class
23
     *
24
     * @return array
25
     */
26
    public function getDatagridValues(ReflectionClass $class): array
27
    {
28
        /** @var DatagridValues|null $annotation */
29
        if ($annotation = $this->getClassAnnotation(
30
            $class,
31
            DatagridValues::class
32
        )) {
33
            return $annotation->values;
34
        }
35
36
        return [];
37
    }
38
39
}
40