Passed
Branch master (046a17)
by Mathieu
02:22
created

DatagridValuesReader   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 6
dl 0
loc 21
rs 10
c 0
b 0
f 0

1 Method

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