FilterExtension   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
c 1
b 0
f 0
dl 0
loc 24
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A loadTypeExtensions() 0 4 1
1
<?php declare(strict_types = 1);
2
3
namespace Bukashk0zzz\FilterBundle\Tests\Form;
4
5
use Bukashk0zzz\FilterBundle\Form\Extension\FormTypeExtension;
6
use Bukashk0zzz\FilterBundle\Service\Filter;
7
use Symfony\Component\Form\AbstractExtension;
8
9
/**
10
 * Filter Extension.
11
 *
12
 * Enabled filtering in forms
13
 */
14
class FilterExtension extends AbstractExtension
15
{
16
    /**
17
     * @var Filter
18
     */
19
    private $filter;
20
21
    /**
22
     * {@inheritdoc}
23
     *
24
     * @param $autoFilter
25
     */
26
    public function __construct(Filter $filterService, protected $autoFilter)
27
    {
28
        $this->filter = $filterService;
29
    }
30
31
    /**
32
     * {@inheritdoc}
33
     */
34
    protected function loadTypeExtensions(): array
35
    {
36
        return [
37
            new FormTypeExtension($this->filter, $this->autoFilter),
38
        ];
39
    }
40
}
41