Completed
Pull Request — master (#347)
by Łukasz
17:04
created

CustomSubscriber   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 3

Importance

Changes 0
Metric Value
wmc 4
lcom 0
cbo 3
dl 0
loc 26
rs 10
c 0
b 0
f 0

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getId() 0 4 1
A getClassName() 0 4 1
A initDataGrid() 0 4 1
A initDataSource() 0 8 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace FSi\FixturesBundle\Admin;
6
7
use FSi\Bundle\AdminBundle\Doctrine\Admin\ListElement;
8
use FSi\Component\DataGrid\DataGridFactoryInterface;
9
use FSi\Component\DataGrid\DataGridInterface;
10
use FSi\Component\DataSource\DataSourceFactoryInterface;
11
use FSi\Component\DataSource\DataSourceInterface;
12
use FSi\FixturesBundle\Entity;
13
14
class CustomSubscriber extends ListElement
15
{
16
    public function getId(): string
17
    {
18
        return 'custom_subscriber';
19
    }
20
21
    public function getClassName(): string
22
    {
23
        return Entity\Subscriber::class;
24
    }
25
26
    protected function initDataGrid(DataGridFactoryInterface $factory): DataGridInterface
27
    {
28
        return  $factory->createDataGrid(Subscriber::ID);
29
    }
30
31
    protected function initDataSource(DataSourceFactoryInterface $factory): DataSourceInterface
32
    {
33
        return $factory->createDataSource(
34
            'doctrine-orm',
35
            ['entity' => $this->getClassName()],
36
            Subscriber::ID
37
        );
38
    }
39
}
40