Schema   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 24
rs 10
c 0
b 0
f 0
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A create() 0 9 1
A handleTable() 0 3 1
A tableExist() 0 3 1
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
Unused Code introduced by
The call to Luke\Schemas\Schema::tableExist() has too many arguments starting with $table. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

20
        self::/** @scrutinizer ignore-call */ tableExist($table);

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.

Loading history...
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