Total Complexity | 4 |
Total Lines | 34 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
8 | abstract class AbstractSeed |
||
9 | { |
||
10 | public function __construct() |
||
11 | { |
||
12 | Request::server()->set([ |
||
13 | "REMOTE_ADDR" => "127.0.0.1", |
||
14 | "HTTP_USER_AGENT" => "Mozilla" |
||
15 | ]); |
||
16 | } |
||
17 | |||
18 | abstract public function create(); |
||
19 | |||
20 | protected function createStmtString(array $fields): array |
||
21 | { |
||
22 | $insert = []; |
||
23 | $execute = []; |
||
24 | |||
25 | foreach ($fields as $key => $data) { |
||
26 | $insert[] = "{$key}"; |
||
27 | $execute[] = ":{$key}"; |
||
28 | } |
||
29 | |||
30 | return [implode(",", $insert), implode(",", $execute)]; |
||
31 | } |
||
32 | |||
33 | protected function execute(string $table, array $fields): void |
||
42 | } |
||
43 | } |
||
44 |