1 | <?php |
||
2 | |||
3 | namespace Luke\Schemas; |
||
4 | |||
5 | use Exception; |
||
6 | use Luke\Types\Blueprint; |
||
7 | use Luke\Migration\Config\Database\Connect; |
||
8 | |||
9 | class Schema |
||
10 | { |
||
11 | /** |
||
12 | * @throws Exception |
||
13 | */ |
||
14 | public static function create(string $table, $callback) |
||
15 | { |
||
16 | $methodType = new Blueprint(); |
||
17 | |||
18 | $callback($methodType); |
||
19 | |||
20 | self::tableExist($table); |
||
0 ignored issues
–
show
|
|||
21 | |||
22 | self::handleTable($table, $methodType->getQuery()); |
||
23 | } |
||
24 | |||
25 | private static function tableExist() |
||
26 | { |
||
27 | return null; |
||
28 | } |
||
29 | |||
30 | private static function handleTable($table, $values) |
||
31 | { |
||
32 | Connect::migrationTable("CREATE TABLE IF NOT EXISTS `$table` ($values)"); |
||
33 | } |
||
34 | |||
35 | |||
36 | // private static function config(){ |
||
37 | // $engine = ' ENGINE=InnoDB '; |
||
38 | // $autIncrement = 'AUTO_INCREMENT=1 '; |
||
39 | // $charset = 'DEFAULT CHARSET=utf8mb4 '; |
||
40 | // $collate = 'COLLATE=utf8mb4_0900_ai_ci;'; |
||
41 | // return $engine . $autIncrement . $charset . $collate; |
||
42 | // } |
||
43 | } |
||
44 |
This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.
If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress. Please note the @ignore annotation hint above.