Completed
Pull Request — master (#21)
by Daniel
02:31
created

SelectCell::createView()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 7
rs 9.4285
cc 1
eloc 3
nc 1
nop 2
1
<?php
2
3
namespace Psi\Component\Grid\Cell;
4
5
use Psi\Component\Grid\CellInterface;
6
use Psi\Component\Grid\CellWithFormInterface;
7
use Symfony\Component\Form\FormBuilderInterface;
8
use Symfony\Component\OptionsResolver\OptionsResolver;
9
use Psi\Component\Grid\RowData;
10
use Psi\Component\Grid\CellViewInterface;
11
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;
12
use Psi\Component\ObjectAgent\AgentFinder;
13
14
class SelectCell implements CellInterface
15
{
16
    private $agentFinder;
17
18
    public function __construct(AgentFinder $agentFinder)
19
    {
20
        $this->agentFinder = $agentFinder;
21
    }
22
23
    public function createView(RowData $data, array $options): CellViewInterface
24
    {
25
        // TODO: This is inefficient and will not work for proxies ...
26
        $agent = $this->agentFinder->findFor(get_class($data->getObject()));
27
28
        return new View\SelectView($agent->getIdentifier($data->getObject()));
29
    }
30
31
    public function configureOptions(OptionsResolver $options)
32
    {
33
    }
34
}
35