Completed
Pull Request — master (#21)
by Daniel
03:27 queued 01:17
created

GridFormFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 5
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 3
nc 1
nop 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Psi\Component\Grid;
6
7
use Psi\Component\Grid\Form\Type\GridType;
8
use Psi\Component\Grid\Metadata\GridMetadata;
9
use Symfony\Component\Form\FormFactoryInterface;
10
use Symfony\Component\Form\FormInterface;
11
12
class GridFormFactory
13
{
14
    const FORM_NAME = 'grid';
15
16
    private $formFactory;
17
    private $cellRegistry;
18
19
    public function __construct(
20
        FormFactoryInterface $formFactory
21
    ) {
22
        $this->formFactory = $formFactory;
23
    }
24
25 View Code Duplication
    public function createForm(GridMetadata $gridMetadata, \Traversable $collection): FormInterface
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
    {
27
        $formBuilder = $this->formFactory->createNamedBuilder(self::FORM_NAME, GridType::class, [
28
            'rows' => $collection,
29
        ], [
30
            'grid_metadata' => $gridMetadata,
31
        ]);
32
33
        return $formBuilder->getForm();
34
    }
35
}
36