Total Complexity | 6 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Coverage | 58.33% |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
23 | trait TableProperty |
||
24 | { |
||
25 | /** |
||
26 | * @var TableInterface instance |
||
27 | */ |
||
28 | protected $table; |
||
29 | |||
30 | /** |
||
31 | * Setup Table instance |
||
32 | * |
||
33 | * @param TableInterface $table |
||
34 | * |
||
35 | * @return void |
||
36 | */ |
||
37 | 44 | public function setTable(TableInterface $table): void |
|
38 | { |
||
39 | 44 | $this->table = $table; |
|
40 | 44 | } |
|
41 | |||
42 | /** |
||
43 | * Return table instance for manipulation |
||
44 | * |
||
45 | * @return TableInterface |
||
46 | * @throws TableNotFoundException |
||
47 | */ |
||
48 | 40 | public function getTable(): TableInterface |
|
49 | { |
||
50 | 40 | if (!$this->table) { |
|
51 | 1 | $this->initTable(); |
|
52 | } |
||
53 | 39 | return $this->table; |
|
54 | } |
||
55 | |||
56 | /** |
||
57 | * Init table instance for manipulation |
||
58 | * |
||
59 | * @return void |
||
60 | * @throws TableNotFoundException |
||
61 | */ |
||
62 | protected function initTable(): void |
||
75 | } |
||
76 | } |
||
77 |