Completed
Push — master ( 481507...e81850 )
by Denis
01:52
created

BaseRenderer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 2
A configTests() 0 6 1
render() 0 1 ?
1
<?php
2
3
namespace Woo\GridView\Renderers;
4
5
use Woo\GridView\GridView;
6
use Woo\GridView\Traits\Configurable;
7
8
abstract class BaseRenderer
9
{
10
    use Configurable;
11
12
    /**
13
     * HTML ID of container
14
     * @var string
15
     */
16
    public $id = '';
17
18
    /**
19
     * BaseRenderer constructor.
20
     * @param $config
21
     * @throws \Woo\GridView\Exceptions\GridViewConfigException
22
     */
23
    public function __construct($config)
24
    {
25
        $this->loadConfig($config);
26
27
        if (empty($this->id)) {
28
            $this->id = 'grid_' . uniqid();
29
        }
30
    }
31
32
    /**
33
     * @return array
34
     */
35
    protected function configTests(): array
36
    {
37
        return [
38
            'id' => 'string',
39
        ];
40
    }
41
42
    public abstract function render(GridView $view) : string;
43
}