Completed
Push — master ( 406296...0a0b96 )
by Daniel
07:00 queued 04:29
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\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