Completed
Push — 1.x ( aadfa3...ac39bc )
by Marko
02:25
created

DatagridAssociationField   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 17
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A getField() 0 10 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace KunicMarko\SonataAnnotationBundle\Annotation;
6
7
/**
8
 * @Annotation
9
 * @Target("PROPERTY")
10
 *
11
 * @author Marko Kunic <[email protected]>
12
 */
13
class DatagridAssociationField extends DatagridField
14
{
15
    /**
16
     * @var string
17
     */
18
    public $field;
19
20
    public function getField(): string
21
    {
22
        if ($this->field) {
23
            return $this->field;
24
        }
25
26
        throw new \InvalidArgumentException(
27
            sprintf(
28
                'Argument "field" is mandatory in "%s" annotation.',
29
                self::class
30
            )
31
        );
32
    }
33
}
34