TableBase   A
last analyzed

Complexity

Total Complexity 7

Size/Duplication

Total Lines 56
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 7
eloc 28
c 0
b 0
f 0
dl 0
loc 56
rs 10

7 Methods

Rating   Name   Duplication   Size   Complexity  
A fillInputs() 0 12 1
A addFilter() 0 5 1
A addPagerHead() 0 4 1
A addScript() 0 4 1
A setData() 0 8 1
A addPagerFoot() 0 4 1
A templatePath() 0 3 1
1
<?php
2
3
namespace kalanis\kw_table\output_kw\Html;
4
5
6
use kalanis\kw_templates\ATemplate;
7
use kalanis\kw_templates\Template\TFile;
8
9
10
class TableBase extends ATemplate
11
{
12
    use TFile;
13
14
    protected function templatePath(): string
15
    {
16
        return __DIR__ . '/../../shared-templates/table-base.html';
17
    }
18
19
    protected function fillInputs(): void
20
    {
21
        $this->addInput('{TABLE_PAGER_HEAD}');
22
        $this->addInput('{TABLE_PAGER_FOOT}');
23
        $this->addInput('{TABLE_SORTER_FILTER}');
24
        $this->addInput('{TABLE_HEAD_FILTER}');
25
        $this->addInput('{TABLE_CELLS}');
26
        $this->addInput('{TABLE_FOOTER_FILTER}');
27
        $this->addInput('{TABLE_SCRIPT}');
28
        $this->addInput('{FILTER_START}');
29
        $this->addInput('{FILTER_END}');
30
        $this->addInput('{CLASSES_IN_STRING}');
31
    }
32
33
    public function addPagerHead(string $pager): self
34
    {
35
        $this->updateItem('{TABLE_PAGER_HEAD}', $pager);
36
        return $this;
37
    }
38
39
    public function addPagerFoot(string $pager): self
40
    {
41
        $this->updateItem('{TABLE_PAGER_FOOT}', $pager);
42
        return $this;
43
    }
44
45
    public function addFilter(string $filterStart, string $filterEnd): self
46
    {
47
        $this->updateItem('{FILTER_START}', $filterStart);
48
        $this->updateItem('{FILTER_END}', $filterEnd);
49
        return $this;
50
    }
51
52
    public function addScript(string $script): self
53
    {
54
        $this->updateItem('{TABLE_SCRIPT}', $script);
55
        return $this;
56
    }
57
58
    public function setData(string $cells, string $header = '', string $headFilter = '', string $footerFilter = '', string $classes = ''): self
59
    {
60
        $this->updateItem('{TABLE_CELLS}', $cells);
61
        $this->updateItem('{TABLE_SORTER_FILTER}', $header);
62
        $this->updateItem('{TABLE_HEAD_FILTER}', $headFilter);
63
        $this->updateItem('{TABLE_FOOTER_FILTER}', $footerFilter);
64
        $this->updateItem('{CLASSES_IN_STRING}', $classes);
65
        return $this;
66
    }
67
}
68