Total Complexity | 7 |
Total Lines | 47 |
Duplicated Lines | 0 % |
Coverage | 35.29% |
Changes | 0 |
1 | <?php |
||
9 | trait TableStructureRecordsTrait |
||
10 | { |
||
11 | protected $tableStructure = null; |
||
12 | |||
13 | protected $fields = null; |
||
14 | |||
15 | /** |
||
16 | * @return null |
||
17 | */ |
||
18 | public function getFields() |
||
19 | { |
||
20 | if ($this->fields === null) { |
||
21 | $this->initFields(); |
||
22 | } |
||
23 | |||
24 | return $this->fields; |
||
25 | } |
||
26 | |||
27 | public function initFields() |
||
28 | { |
||
29 | $structure = $this->getTableStructure(); |
||
30 | $this->fields = array_keys($structure['fields']); |
||
31 | } |
||
32 | |||
33 | /** |
||
34 | * @return mixed |
||
35 | */ |
||
36 | 2 | protected function getTableStructure() |
|
43 | } |
||
44 | |||
45 | /** |
||
46 | * @param null $tableStructure |
||
|
|||
47 | */ |
||
48 | 3 | public function setTableStructure($tableStructure) |
|
49 | { |
||
50 | 3 | $this->tableStructure = $tableStructure; |
|
51 | 3 | } |
|
52 | |||
53 | protected function initTableStructure() |
||
56 | } |
||
57 | } |
||
58 |