ObjectTableRenderer   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 30
wmc 5
lcom 0
cbo 2
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A handles() 0 3 2
A getHeaders() 0 3 1
A getRows() 0 7 2
1
<?php
2
namespace rtens\domin\delivery\cli\renderers\tables;
3
4
use rtens\domin\delivery\web\renderers\tables\types\ObjectTable;
5
6
class ObjectTableRenderer extends TableRenderer {
7
8
    /**
9
     * @param mixed $value
10
     * @return bool
11
     */
12
    public function handles($value) {
13
        return $value instanceof ObjectTable && $this->canDrawTables();
14
    }
15
16
    /**
17
     * @param ObjectTable $table
18
     * @return mixed
19
     */
20
    protected function getRows($table) {
21
        $rows = [];
22
        foreach ($table->getItems() as $object) {
23
            $rows[] = $table->getCells($object);
24
        }
25
        return $rows;
26
    }
27
28
    /**
29
     * @param ObjectTable $table
30
     * @return mixed
31
     */
32
    protected function getHeaders($table) {
33
        return $table->getHeaders();
34
    }
35
}