Total Complexity | 10 |
Total Lines | 58 |
Duplicated Lines | 0 % |
Coverage | 96.3% |
Changes | 1 | ||
Bugs | 0 | Features | 1 |
1 | <?php |
||
9 | class DatabaseTable implements TableInterface |
||
10 | { |
||
11 | private Database $db; |
||
12 | private string $name; |
||
13 | |||
14 | 6 | public function __construct(string $name, Database $db) |
|
15 | { |
||
16 | 6 | $this->db = $db->select($name); |
|
17 | 6 | $this->name = $name; |
|
18 | 6 | } |
|
19 | |||
20 | 1 | public function sort(string $key, $order = 'ASC'): self |
|
21 | { |
||
22 | 1 | $this->db = $this->db->orderBy($key, $order); |
|
23 | 1 | return $this; |
|
24 | } |
||
25 | |||
26 | 1 | public function columns($keys): self |
|
27 | { |
||
28 | 1 | $this->db = $this->db->select($this->name, $keys); |
|
29 | 1 | return $this; |
|
30 | } |
||
31 | |||
32 | 1 | public function filter(string $key, $value): self |
|
36 | } |
||
37 | |||
38 | 1 | public function search(string $key, $value): self |
|
39 | { |
||
40 | // $this->db = $this->db->where($key, $value, 'LIKE'); |
||
41 | 1 | return $this; |
|
42 | } |
||
43 | |||
44 | 2 | public function range(int $offset, ?int $limit = null): self |
|
54 | } |
||
55 | |||
56 | 1 | public function paginate(int $page = 0, int $pageSize = 10): self |
|
62 | } |
||
63 | |||
64 | 6 | public function run(): array |
|
69 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
integer
values, zero is a special case, in particular the following results might be unexpected: