Completed
Pull Request — master (#37)
by Greg
03:21 queued 01:22
created

CallableRenderer   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 0
dl 0
loc 18
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A renderCell() 0 4 1
1
<?php
2
namespace Consolidation\OutputFormatters\StructuredData;
3
4
use Consolidation\OutputFormatters\Options\FormatterOptions;
5
6
class CallableRenderer implements RenderCellInterface
7
{
8
    /** @var callable */
9
    protected $renderFunction;
10
11
    public function __construct(callable $renderFunction)
12
    {
13
        $this->renderFunction = $renderFunction;
14
    }
15
16
    /**
17
     * {@inheritdoc}
18
     */
19
    public function renderCell($key, $cellData, FormatterOptions $options)
20
    {
21
        return ($this->renderFunction)($key, $cellData, $options);
22
    }
23
}
24