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

SelectCell   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 3

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 1
cbo 3
dl 0
loc 21
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A createView() 0 7 1
A configureOptions() 0 3 1
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