Completed
Push — master ( 2b45da...60f6b8 )
by Arnaud
16s queued 12s
created

BooleanField::configureOptions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
cc 1
eloc 2
c 0
b 0
f 0
nc 1
nop 2
dl 0
loc 4
ccs 0
cts 4
cp 0
crap 2
rs 10
1
<?php
2
3
namespace LAG\AdminBundle\Field;
4
5
use LAG\AdminBundle\Configuration\ActionConfiguration;
6
use LAG\AdminBundle\Field\Traits\TwigAwareTrait;
7
use Symfony\Component\OptionsResolver\OptionsResolver;
8
9
class BooleanField extends AbstractField implements TwigAwareFieldInterface
10
{
11
    use TwigAwareTrait;
12
13
    public function isSortable(): bool
14
    {
15
        return true;
16
    }
17
18
    public function configureOptions(OptionsResolver $resolver, ActionConfiguration $actionConfiguration)
19
    {
20
        $resolver->setDefaults([
21
            'template' => '@LAGAdmin/Field/boolean.html.twig',
22
        ]);
23
    }
24
25
    public function render($value = null): string
26
    {
27
        return $this->twig->render($this->options['template'], [
28
            'value' => $value,
29
        ]);
30
    }
31
}
32