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

SelectCell::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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