Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
CRAP | |
100.00% |
1 / 1 |
Table | |
100.00% |
5 / 5 |
|
100.00% |
4 / 4 |
4 | |
100.00% |
1 / 1 |
__construct | |
100.00% |
2 / 2 |
|
100.00% |
1 / 1 |
1 | |||
create | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
__toString | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
empty | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 |
1 | <?php |
2 | |
3 | declare(strict_types=1); |
4 | |
5 | namespace Projom\Storage\SQL\Component; |
6 | |
7 | use Projom\Storage\SQL\Component\ComponentInterface; |
8 | use Projom\Storage\SQL\Util; |
9 | |
10 | class Table implements ComponentInterface |
11 | { |
12 | private string $table = ''; |
13 | |
14 | public function __construct(array $table) |
15 | { |
16 | $table = Util::cleanList($table); |
17 | $this->table = Util::quoteAndJoin($table, ', '); |
18 | } |
19 | |
20 | public static function create(array $table): Table |
21 | { |
22 | return new Table($table); |
23 | } |
24 | |
25 | public function __toString(): string |
26 | { |
27 | return $this->table; |
28 | } |
29 | |
30 | public function empty(): bool |
31 | { |
32 | return empty($this->table); |
33 | } |
34 | } |